Author Topic: basic lisp help  (Read 2073 times)

0 Members and 1 Guest are viewing this topic.

Anonymous

  • Guest
basic lisp help
« on: October 26, 2004, 06:51:27 AM »
(defun  c:d1()

   (setq dp1(getpoint))
   (setq dp2(getpoint))
   
   (command "-insert" "9d" "r" dp1 dp2 dp1 "" "")
   
   (command "align" "l" dp1 dp1 dp2 dp2 "" "y")

)

this is a little routine i have "created" to allow me to insert a door in an ope.  the job is for an old building and none of the doors opes are the same size.  the drawing is for fire certification so i only need to show a door symbol. ( a line and an arc)

my problem is it inserts the block of the door at the right rotation angle but i want it to scale  to the opening as well, so i thought by using the align command on the same 2 pick points that i can achieve what i am trying to do, when the programe gets to the align part it ignores the to point values i have and wants me to insert 2 new points.

can somebody please point me in the right direction

thanks in advance

Diarmuid

diarmuid

  • Bull Frog
  • Posts: 417
basic lisp help
« Reply #1 on: October 26, 2004, 07:14:44 AM »
its o.k. i've solved it myself

if anybody can make any improvements suggestions i would welcome them

new code below...

(defun  c:d1()

   (setq dp1(getpoint))
   (setq dp2(getpoint))

   (setq dist1(distance dp1 dp2))
   
   (command "-insert" "9d" "r" dp1 dp2 dp1 "" "")
   
   (command "scale" "l" "" dp1 dist1)

)
If you want to win something run the 100m, if you want to experience something run a marathon

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
basic lisp help
« Reply #2 on: October 26, 2004, 07:36:45 AM »
I was thinking more along the lines of this;
Code: [Select]

(defun c:gugh (/ p1 p2 ang)

  (defun rtd (x)
(/ (* x 180.0) pi)
)


  ;; assuming your block is one unit before scaling
 
  (setq p1 (getpoint "\nPick hinge point: ")
p2 (getpoint p1 "\nDoor openning: ")
ang (rtd (getangle p1 "\nAngle: "))
)

  (command "_insert" "door" p1 (distance p1 p2) "" ang)

  )
TheSwamp.org  (serving the CAD community since 2003)

diarmuid

  • Bull Frog
  • Posts: 417
basic lisp help
« Reply #3 on: October 26, 2004, 07:50:32 AM »
thanks again

saves me a whole bunch of time.

Thanks.
If you want to win something run the 100m, if you want to experience something run a marathon