Author Topic: Lisp request  (Read 2930 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Lisp request
« on: December 05, 2005, 01:12:41 PM »
I have this block that I just created for out Townhome plans. The block show a Property Line with symbol, and party Wall Detail Call out. I have put 2 point in the block to start and finish pick points. So I would like to the start pick a point and stretch to the end point. Please see that attachment for the block. Please keep the linetypes and layers as is.

If you have questions please ask me.

Thank you,

Brad

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Lisp request
« Reply #1 on: December 05, 2005, 02:36:58 PM »
... So I would like to the start pick a point and stretch to the end point. .....

If you have questions please ask me.
I don't know what it is you want......could you explain this a bit more clearly? But I think that you want a dynamic block, which you will get by upgrading to 2006.

One Shot

  • Guest
Re: Lisp request
« Reply #2 on: December 05, 2005, 03:55:35 PM »
I don't know what it is you want......could you explain this a bit more clearly? But I think that you want a dynamic block, which you will get by upgrading to 2006.
Quote

We will not be upgrading to 2006 in the near future.  We are using 2005 in the office here.  I have attached a drawing to help you to see what I will be using this lisp for. 

I would like to use this lisp to add that block in question to my plans.  You would first pick a point of the corner of the wall for the insertion starting point and the pick the opposite corner for the end point.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Lisp request
« Reply #3 on: December 05, 2005, 05:56:42 PM »
OK, I see what you want. Too bad 2006 isn't in your future, a dynamic block would work perfect for this.

Are the attributed blocks to be a part of the inserted block or individual blocks? I've got a few ideas, but I may not have the time to devote for a full solution for a while.

One Shot

  • Guest
Re: Lisp request
« Reply #4 on: December 05, 2005, 09:45:00 PM »
OK, I see what you want. Too bad 2006 isn't in your future, a dynamic block would work perfect for this.

Are the attributed blocks to be a part of the inserted block or individual blocks? I've got a few ideas, but I may not have the time to devote for a full solution for a while.

I know that the dynamic blocks would work perfect.  The attributes are to be apart of the primary block.

Thank you,

Brad

Fatty

  • Guest
Re: Lisp request
« Reply #5 on: December 06, 2005, 10:26:39 AM »
I have this block that I just created for out Townhome plans. The block show a Property Line with symbol, and party Wall Detail Call out. I have put 2 point in the block to start and finish pick points. So I would like to the start pick a point and stretch to the end point. Please see that attachment for the block. Please keep the linetypes and layers as is.

If you have questions please ask me.

Thank you,

Brad


Hi Brad

I have similar routine that I wrote some time ago
I edited this few and you can use it like as framework
(work with your linetypes and layers and with blocks)

Thank you


Code: [Select]
(defun err (s)
  (if (/= s "Function cancelled\n")
    (if (= s "quit / exit abort")
    (princ)
        (princ " >> Error << \n")
    )
  )

  (setvar "CMDECHO" 1)
  (setvar "QAFLAGS" 0)
  (setvar "OSMODE" osm)
  (setvar "ATTREQ" atq)
  (setvar "ATTDIA" atd)
  (setvar "CMDDIA" cma)
  (setvar "CLAYER" clr)
   (while (> (getvar "cmdactive") 0) (command))
   (command "._undo" "_end")
   (setq *error* olderr)
   (princ)
)

(defun C:smb (/       ang     atd     atq     bname   clr     cma
      err     len     ln      ln_ent  olderr  osm     p1
      p1ax    p2      p2ax    pause   pin     pl1     pl2
      pln     pln_ent pr1     pr2     pref    prop_list1
      prop_list2      prop_names      sset
     )

  (vl-load-com)
  (setq olderr *error*
*error* err
  )
  (command "_.undo" "_end")
  (command "_.undo" "_g")
  (setq atq (getvar "ATTREQ"))
  (setq atd (getvar "ATTDIA"))
  (setq cma (getvar "CMDDIA"))
  (setq osm (getvar "OSMODE"))
  (setq clr (getvar "CLAYER"))
  (setvar "CMDECHO" 0)
  (setvar "QAFLAGS" 1)
  (setvar "ATTREQ" 0)
  (setvar "ATTDIA" 0)
  (setvar "CMDDIA" 0)
  (setvar "OSMODE" 703)

  (setq prop_names
'("Constantwidth"     "Color"    "Layer"
   "Linetype"        "Linetypegeneration"
   "Linetypescale"     "Lineweight"
  )
  )

  (setq prop_list1 '(1.0 7 "A-Anno-Symb" "HIDDEN" :vlax-false 1.0 -1))
  (setq prop_list2
'(1.0 256 "C-Prop-Plin" "BYLAYER" :vlax-false 1.0 -1)
  )
  (setq sset (ssadd))
  (setq p1   (getpoint "\nStarting point (Enter to stop) : \n")
p2   (getpoint p1 "\nEnding point : \n")
p1ax (getpoint p1 "\nStart point of axis : \n")
p2ax (getpoint p2 "\nEnd point of axis : \n")
ang  (angle p1 p2)
len  (rtos (distance p1 p2) 2 0)
pl1  (polar p1 (+ ang (/ pi 2)) 14.)
pl2  (polar p1 (- ang (/ pi 2)) 14.)
pr1  (polar p2 (+ ang (/ pi 2)) 14.)
pr2  (polar p2 (- ang (/ pi 2)) 14.)
  )
  (command "pline")
  (mapcar 'command (list pl1 pr1 pr2 pl2))
  (command "c")
  (setq pln_ent (entlast))
  (ssadd pln_ent sset)
  (setq pln (vlax-ename->vla-object pln_ent))
  (mapcar (function (lambda (x y)
      (vl-catch-all-apply
(function (lambda ()
    (vlax-put-property pln x y)
  )
)
      )
    )
  )
  prop_names
  prop_list1
  )
  (vla-setbulge pln 1 -1)
  (vla-setbulge pln 3 -1)

  (vla-update pln)
  (command "line" p1ax p2ax "")
  (setq ln_ent (entlast))
  (ssadd ln_ent sset)
  (setq ln (vlax-ename->vla-object ln_ent))
  (mapcar (function (lambda (x y)
      (vl-catch-all-apply
(function (lambda ()
    (vlax-put-property ln x y)
  )
)
      )
    )
  )
  prop_names
  prop_list2
  )
  (vla-update ln)
  (setq pref  (getstring "\nEnter block name prefix : \n")
bname (strcat pref len)
  )
  (command "-block" bname p1 ln_ent pln_ent "")
  (command "delay" 200)
  (setvar "CLAYER" "0")
  (if (tblsearch "block" bname)
    (command "-insert" bname p1 1 1 0)
    (alert "Block is not exist")
  )
  (prompt "\n\t\t***\tMultiple insertion of block \"D\" ... \t***\n")
  (while (setq pin (getpoint "\nPick insertion point (Enter to stop) : \n"))
    (command "-insert" "D" pin 1 1 0)
    (initdia)
    (command "attedit" (entlast) pause)
  )
  (setvar "CMDECHO" 1)
  (setvar "QAFLAGS" 0)
  (setvar "ATTREQ" atq)
  (setvar "ATTDIA" atd)
  (setvar "CMDDIA" cma)
  (setvar "CLAYER" clr)
  (command "_.undo" "_end")
  (setq *error* olderr)
  (princ)
)
 (prompt "\n\t\t***\tType SMB to execute ... \t***\n")