View Full Version : 3DPOLY within a lisp
GuinnessCAD
2007-02-28, 08:04 PM
Here is my brutal attempt at lisp. What I am trying to accomplish is creating a breakline from 3d points and also create a copy of the 3d polyline convert it to a 2d line and change the 2d line to another layer. I would like to run the 3dpoly command inside the lisp, but my abilities are not quite there. Attached is my code and drawing. When drawing the 3d pline draw from the center of circles.
Hopefully, I can look at this later today. Until then, look at this post regarding the CMDACTIVE system variable.
GuinnessCAD
2007-03-02, 03:08 PM
Hopefully, I can look at this later today. Until then, look at this post regarding the CMDACTIVE system variable.I tried using the CMDACTIVE unsuccessfully. I just need to figure out how to pause the lisp until the 3d polyline has been drawn, any ideas?
kennet.sjoberg
2007-03-02, 03:49 PM
I tried using the CMDACTIVE unsuccessfully. I just need to figure out how to pause the lisp until the 3d polyline has been drawn, any ideas?
Try again . .
(command "_3dpoly")
(while (= (getvar "CMDACTIVE") 1 ) (command pause) )
: ) Happy Computing !
kennet
GuinnessCAD
2007-03-02, 06:13 PM
Try again . .
(command "_3dpoly")
(while (= (getvar "CMDACTIVE") 1 ) (command pause) )
: ) Happy Computing !
kennetOK that works, now the flatten command wont work in lisp. But it works just keying in the command on my computer, is that normal? Flatten is not lisp compatable?
Revised code:
;;;Program Name topo-pave.LSP
;;;Author: Mark LaBell Jr.
;;;February 28, 2007
;;;This lisp routine draws a road breakline, and the road geometry in 2d.
;;; ----------------------------------------------------------------------------
;;; DISCLAIMER: Mark LaBell Jr. Disclaims any and all liability for any damages
;;; arising out of the use or operation, or inability to use the software.
;;; FURTHERMORE, User agrees to hold Mark LaBell Jr. harmless from such claims.
;;; Mark LaBell Jr. makes no warranty, either expressed or implied, as to the
;;; fitness of this product for a particular purpose. All materials are
;;; to be considered ‘as-is’, and use of this software should be
;;; considered as AT YOUR OWN RISK.
;;; ----------------------------------------------------------------------------
(defun C:rd ()
;;;
;;;Get user variables
;;;
(setq c_layer (getvar "clayer"))
(setq o_mode (getvar "osmode"))
;; (setvar "osmode" 8)
;;(command "cmdecho" 0)
(command "undo" "be" )
;;;
;;;Create layers for desired output
;;;
(command "-layer" "m" "SM-BRKLN-RD" "c" "7" "SM-BRKLN-RD" "th" "SM-BRKLN-RD" "")
(command "-layer" "m" "EX-RD-PAVED" "c" "131" "EX-RD-PAVED" "th" "EX-RD-PAVED" "")
(command "-layer" "m" "EX-RD-UNPAVED" "c" "131" "EX-RD-UNPAVED" "th" "EX-RD-UNPAVED" "")
;;;
;;;Thaw and turn on layers for desired output
;;;
(command "-layer" "t" "SM-BRKLN-RD" "")
(command "-layer" "t" "EX-RD-PAVED" "")
(command "-layer" "t" "EX-RD-UNPAVED" "")
;;;
;;;Draw 3d poly
;;;
(command "clayer" "SM-BRKLN-RD" )
(command "_3dpoly" )
(while (= (getvar "CMDACTIVE") 1 ) (command pause) )
;;;
;;;Copy 3d geometry to Pave layer
;;;
(command "_copybase" "0,0,0" "l" "")
(command "_pasteclip" "0,0,0" )
(setq road (getstring "\nEnter Layer which the breakline will reside on: EX-RD-PAVED or EX-RD-UNPAVED "))
(command "change" "P" "" "p" "LA" road "")
(command "_flatten" "p" "n" "")
(command "explode" "l" "")
;;;
;;;Return User variables
;;;
(setvar "clayer" c_layer)
(setvar "osmode" o_mode)
(command "undo" "e" )
(command "cmdecho" 1)
(princ)
(prompt "You have created a breakline and the road.")
(princ)
)
kennet.sjoberg
2007-03-02, 07:54 PM
OK that works, now the flatten command wont work in lisp. But it works just keying in the command on my computer, is that normal? Flatten is not lisp compatable?
Flatten is not an AutoCAD command, I suppose it is a lisp that you have loaded,
you can not call a lisp within a lisp as a command, you must use the lisp way
(flatten) or (c:flatten) or (flatten arg1 arg2 . . ) or
sorry I can not help you here, I do not have the flatten file.
: ) Happy Computing !
kennet
GuinnessCAD
2007-03-02, 07:58 PM
Flatten is not an AutoCAD command, I suppose it is a lisp that you have loaded,
you can not call a lisp within a lisp as a command, you must use the lisp way
(flatten) or (c:flatten) or (flatten arg1 arg2 . . ) or
sorry I can not help you here, I do not have the flatten file.
: ) Happy Computing !
kennetGotcha, I actually just programmed a super move into the lisp,
(command "._move" "p" "" "0,0,1e99" "")
(command "._move" "p" "" "0,0,-1e99" "")
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.