PDA

View Full Version : Lisp Routines Not Working in Current USC



GMANSQUARE
13th Aug 2007, 07:28 pm
We have many autocad drawings that have the building rotated at about 1.8 degree.

When we xref the working file into our drawings, we use DDUCS and set to a view that was preset. This rotates the building so that all the walls are staright up and down and left and right. This makes it easier to draw our ductwork, text, etc.

When we try to use our many lisp routines, they do not work, we get errors and things are no drawn the way they should. If we set the usc back to world, they work fine.

How can get the lisp routine working, without rotating the building in the xref file.

Thanks

David Bethel
13th Aug 2007, 07:43 pm
You can fix the routines, but it could be a daunting task. There are very many different scenarios that have to be addressed.

i.e.

If the program makes lines or various types of polylines via (entmake), all points are stored in WCS and group 210 must be specified. 210 is defaulted to WCS (0 0 1). Some dimension points also are WCS, some are UCS That could be a lot translating points.

Some editing commands force the selected entity to be in the cuurent UCS.

So every routine would have to be checked. -David

GMANSQUARE
13th Aug 2007, 07:55 pm
Well,

We have 100's of lisp routines, and we use a lot of the entget and getpoint to get various coordinates. We draw line and plines with the points

I have copied a very simple routine that I wrote,

So, I would have to modify this routine to something different,


(defun c:DuctFitting-16 ()
(SETQ OLDL (GETVAR "CLAYER"))
(setq d1 nil)
(graphscr)
(setq pt1 (getpoint "\n.....Select Point To Insert Supply Diffuser.....: "))
(PROMPT "\n.")
(PROMPT "\n.")
(setq w (getint "\n.....Enter the Width Of the Diffuser.....: "))
(PROMPT "\n.")
(PROMPT "\n.")
(setq H (getint "\n.....Enter the Length Of the Diffuser.....: "))
(PROMPT "\n.")
(PROMPT "\n.")
(setq D1 (getreal "\n.....Enter The Round Branch Duct Size....(inches)..... :"))

(setq ang1 0)
(setq ang2 (/ pi 2))
(setq ang3 pi)
(setq ang4 (* pi 1.5))
(setq pt2 (polar pt1 ang2 w))
(setq pt3 (polar pt2 ang1 h))
(setq pt4 (polar pt1 ang1 h))
(setq pt5 (polar pt2 ang1 (/ h 2)))
(if (AND (/= W nil)(/= H nil))
(progn
(rgvlayr "M-HVAC-ATD" "6" "1")
(setq A1 (strcat (ITOA (FIX d1)) "\042" "%%C"))
(setq d2 (/ d1 2))
(setq pt6 (polar pt5 ang1 (- d2 2)))
(setq pt7 (polar pt5 ang1 (+ d2 2)))
(setq pt8 (polar pt5 ang3 (- d2 2)))
(setq pt9 (polar pt5 ang3 (+ d2 2)))
(setq pt10 (polar pt1 ang2 (/ w 2)))
(setq pt11 (polar pt10 ang1 (/ h 2)))
(setq pt12 (polar pt11 ang1 d2))
(setq pt13 (polar pt11 ang3 d2))
(setq pt14 (polar pt11 ang2 d2))
(setq pt15 (polar pt11 ang4 d2))
(setq pt16 (polar pt7 ang4 1))
(setq pt17 (polar pt9 ang4 1))
(setq pt18 (inters pt1 pt3 pt7 pt16 nil))
(setq pt19 (inters pt1 pt3 pt9 pt17 nil))
(setq pt20 (inters pt2 pt4 pt7 pt16 nil))
(setq pt21 (inters pt2 pt4 pt9 pt17 nil))
(setq pt22 (polar pt12 ang2 w))
(setq pt23 (polar pt13 ang2 w))
(setq pt24 (polar pt11 ang2 (* w 0.75)))
(command "zoom" pt1 pt3)
(command "rectangle" pt1 pt3)
(command "line" pt1 pt3 "")
(command "line" pt2 pt4 "")
))

David Bethel
13th Aug 2007, 10:22 pm
(command "line" pt1 pt3 "")
(command "line" pt2 pt4 "")
))


Without doing any testing, my guess is that would you have to do this as a minimum:



(command "_.LINE" (trans pt1 1 0) (trans pt3 1 0) "")
(command "_.LINE" (trans pt2 1 0) (trans pt4 1 0) "")
(trans pt 1 0) = translate pt from current UCS (1) to WCS (0).
-David