chadley
2008-06-27, 06:30 PM
Hi,
I'm no programmer but I found this routine from Cadalyst Magazine and did a few edits to make it work in our office. Anyway, since I’m no programmer I’m sure what I did was wrong but it actually works. The only thing I want to add is, code that deletes a line that is made with this routine. The routine is a called Shelf and Rod. It draws the closet lines on an architectural floor plan. Thing is we use ADT 2006 and so the routine in it’s original form looks for a line not a wall style. My solution was to have the user draw the line and then let routine proceed. But to clean things up a bit I would like to get rid of the line they drew to start with. In fact I would mind getting rid of the part where they have to select the line for offset. I don’t know how to do that part. Any suggestions on how to accomplish what I need?
Thanks!
(defun *error* (msg)
(setvar "OSMODE" TOSMODE)
(setvar "ORTHOMODE" TORTHOMODE)
(setvar "CLAYER" TCLAYER)
(prompt msg)
(princ)
);end defun
(DEFUN C:SHELFROD ()
(graphscr)
(setvar "CMDECHO" 0)
(setq
TOSMODE (getvar "OSMODE")
TORTHOMODE (getvar "ORTHOMODE")
TCLAYER (getvar "CLAYER")
)
;(Alert "\nDraw wall line at back of closet" )
;(setq wall(command "line"(getpoint)(getpoint) ""))
(setvar "OSMODE" 3); end
(setq
line (command "line"(getpoint "\nSelect first point at back of closet" )(getpoint "\nSelect second point at back of closet" ) "")
wallline (entsel "\nClick on wall line" )
firstendpnt (trans (cdr (assoc 10 (entget (car wallline)))) 0 1)
secondendpnt (trans (cdr (assoc 11 (entget (car wallline)))) 0 1)
pnt2 (getpoint "\nSpecify point toward closet: ")
ang1 (angle firstendpnt secondendpnt)
);end setq
(if (and (> ang1 (/ pi 2.0)) (<= ang1 (* pi 1.5)))
(setq ang1 (+ ang1 pi))
);end if
(setvar "OSMODE" 0); none
(command
"offset" 12 wallline pnt2 ""
"-layer" "m" "1- Cabinets-1" "c" "green" "1- Cabinets-1" ""
"change" "L" "" "P" "LA" "1- Cabinets-1" "lt" "dashed2" ""
"offset" 10 wallline pnt2 ""
"change" "L" "" "P" "LA" "1- Cabinets-1" "lt" "center2" ""
)
(setvar "OSMODE" TOSMODE)
(setvar "ORTHOMODE" TORTHOMODE)
(setvar "CLAYER" TCLAYER)
(princ))
(prompt "\nLoaded SHELFROD")
;;;
(C:SHELFROD)
Moderator Note:
Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
I'm no programmer but I found this routine from Cadalyst Magazine and did a few edits to make it work in our office. Anyway, since I’m no programmer I’m sure what I did was wrong but it actually works. The only thing I want to add is, code that deletes a line that is made with this routine. The routine is a called Shelf and Rod. It draws the closet lines on an architectural floor plan. Thing is we use ADT 2006 and so the routine in it’s original form looks for a line not a wall style. My solution was to have the user draw the line and then let routine proceed. But to clean things up a bit I would like to get rid of the line they drew to start with. In fact I would mind getting rid of the part where they have to select the line for offset. I don’t know how to do that part. Any suggestions on how to accomplish what I need?
Thanks!
(defun *error* (msg)
(setvar "OSMODE" TOSMODE)
(setvar "ORTHOMODE" TORTHOMODE)
(setvar "CLAYER" TCLAYER)
(prompt msg)
(princ)
);end defun
(DEFUN C:SHELFROD ()
(graphscr)
(setvar "CMDECHO" 0)
(setq
TOSMODE (getvar "OSMODE")
TORTHOMODE (getvar "ORTHOMODE")
TCLAYER (getvar "CLAYER")
)
;(Alert "\nDraw wall line at back of closet" )
;(setq wall(command "line"(getpoint)(getpoint) ""))
(setvar "OSMODE" 3); end
(setq
line (command "line"(getpoint "\nSelect first point at back of closet" )(getpoint "\nSelect second point at back of closet" ) "")
wallline (entsel "\nClick on wall line" )
firstendpnt (trans (cdr (assoc 10 (entget (car wallline)))) 0 1)
secondendpnt (trans (cdr (assoc 11 (entget (car wallline)))) 0 1)
pnt2 (getpoint "\nSpecify point toward closet: ")
ang1 (angle firstendpnt secondendpnt)
);end setq
(if (and (> ang1 (/ pi 2.0)) (<= ang1 (* pi 1.5)))
(setq ang1 (+ ang1 pi))
);end if
(setvar "OSMODE" 0); none
(command
"offset" 12 wallline pnt2 ""
"-layer" "m" "1- Cabinets-1" "c" "green" "1- Cabinets-1" ""
"change" "L" "" "P" "LA" "1- Cabinets-1" "lt" "dashed2" ""
"offset" 10 wallline pnt2 ""
"change" "L" "" "P" "LA" "1- Cabinets-1" "lt" "center2" ""
)
(setvar "OSMODE" TOSMODE)
(setvar "ORTHOMODE" TORTHOMODE)
(setvar "CLAYER" TCLAYER)
(princ))
(prompt "\nLoaded SHELFROD")
;;;
(C:SHELFROD)
Moderator Note:
Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)