PDA

View Full Version : Looking for Zero.lsp routine



moshira_hassan
2006-11-09, 06:14 PM
Helloo people .. I need the zero lisp plzzzzzzzzzzzz

madcadder
2006-11-09, 06:16 PM
what is a
zero lisp?

moshira_hassan
2006-11-09, 06:22 PM
it's a lisp that change all z coordinates to zero .....

CADmium
2006-11-09, 06:26 PM
try www.cadwiesel.de -> Sonstiges->Sonstiges -> Plaetten

ccowgill
2006-11-09, 06:29 PM
I thought that was the flatten command, and it was an express tool

tedg
2006-11-15, 01:34 PM
it's a lisp that change all z coordinates to zero .....
Here's a good one if you don't have express tools for the "flatten" tool.
It works on most entities, sometimes you need to run it more than once.


(defun c:ELZ (/ cent el ent i na newel nst st stx)
(princ "\nElevation Zero")

(defun WORKING ()
(if (= wrkcnt nil)(setq wrkcnt 0))
(setq wrkcnt (1+ wrkcnt))
(if (= wrkcnt 1)(setq wrk "-"))
(if (= wrkcnt 2)(setq wrk "\\"))
(if (= wrkcnt 3)(setq wrk "|"))
(if (= wrkcnt 4)
(progn (setq wrk "/")(setq wrkcnt 0))
)
(princ (strcat "\n" wrk "\n"))
)

(setq ent (ssget '((-4 . "<OR")(0 . "LINE")(0 . "TEXT")
(0 . "POLYLINE")(0 . "LWPOLYLINE")(0 . "VERTEX")(0 . "ARC")
(0 . "CIRCLE")(0 . "ELLIPSE")(0 . "INSERT")
(0 . "MTEXT")(0 . "POINT")(-4 . "OR>")))
)
(setq el (sslength ent))
(princ el)
(setq i 0)
(repeat el
(working)
(setq na (ssname ent i) i (1+ i))
(setq cent (entget na))
(setq st (assoc 10 cent))
(setq stx (cadr st) sty (caddr st))
(setq nst (list 10 stx sty 0.0))
(setq newel (subst nst st cent))
(entmod newel)
(if (= (cdr (assoc 0 cent)) "LINE")
(progn
(setq na (ssname ent (- i 1)))
(setq cent (entget na))
(setq st (assoc 11 cent))
(setq stx (cadr st) sty (caddr st))
(setq nst (list 11 stx sty 0.0))
(setq newel (subst nst st cent))
(entmod newel)
)
)
)
(princ)
)

(princ)


Have fun.

rkmcswain
2006-11-15, 04:33 PM
Helloo people .. I need the zero lisp plzzzzzzzzzzzz

http://groups.google.com/group/autodesk.autocad.customization/msg/8a47cd8a5984d80b?dmode=source&hl=en

BrenBren
2006-11-15, 04:53 PM
Helloo people .. I need the zero lisp plzzzzzzzzzzzz

AutoCAD 2007 also has the FLATSHOT command, which does the same, or as mentioned above, there is the FLATTEN express tool, which showed up, oh, maybe 2005 or so...

sinc
2006-11-16, 01:38 AM
Land Desktop has a "Flatten Z Values" command, which I always thought should have been in Vanilla instead...

BrenBren
2006-11-16, 12:21 PM
Land Desktop has a "Flatten Z Values" command, which I always thought should have been in Vanilla instead...

See my post above - Vanilla does include tools to do this; the command may not be the same but the tools are there :confused:

TobyKanoby
2006-11-16, 03:05 PM
This link suggested by RKMcwain a few threads above is the shortest version I've found.
http://groups.google.com/group/autodesk.autocad.customization/msg/8a47cd8a5984d80b?dmode=source&hl=en

Can anyone explain what the "_si" part of the "move" command is actually doing in that code?
(command "._move" "_si" ssFlat ...

kennet.sjoberg
2006-11-16, 04:00 PM
This link suggested by RKMcwain a few threads above is the shortest version I've found.
http://groups.google.com/group/autodesk.autocad.customization/msg/8a47cd8a5984d80b?dmode=source&hl=en

Can anyone explain what the "_si" part of the "move" command is actually doing in that code?
(command "._move" "_si" ssFlat ...

a getdata function like "fence" or "remove", the "_si" is to accept only one object, you can rewrite the line to :
(command "._move" ssFlat "" to end the select object prompt.

: ) Happy Computing !

kennet

Steve Couch
2011-06-01, 10:50 PM
(defun zpline ()
(modz entss1)
(setq entn (entget (entnext namss1)))
(while (= (cdr (assoc 0 entn)) "VERTEX")
(modz entn)
(setq entn (entget (entnext (cdr (assoc -1 entn)))))
)
)
(defun modz (ent / )
(setq st (assoc 10 ent))
(cond
(st (setq ps (cdr (assoc 10 ent)))
(setq z1 (caddr ps))
(setq nz1 0.0)
(setq ps (subst nz1 z1 ps))
(setq ent (subst (cons 10 ps) (assoc 10 ent) ent))
(entmod ent)
)
)
(setq fin (assoc 11 ent))
(cond
(fin (setq pe (cdr (assoc 11 ent)))
(setq z2 (caddr pe))
(setq nz2 0.0)
(setq pe (subst nz2 z2 pe))
(setq ent (subst (cons 11 pe) (assoc 11 ent) ent))
(entmod ent)
)
)
)
(defun c:zzero () ;reduces z coordinate of entities to zero
; (setq scz (getreal "\nEnter z direction reduction factor: "))
(setq ss1 (ssget))
(setq lenss1 (sslength ss1))
(setq x 0)
(while (< x lenss1)
(setq namss1 (ssname ss1 x))
(setq entss1 (entget namss1))
(if (= (cdr (assoc 0 entss1)) "POLYLINE")
(progn (zpline) (entupd namss1))
(modz entss1)
)
(setq x (1+ x))
)
)

szm.bordel352396
2013-01-16, 04:13 PM
Hi guys, I bump this thread because I need help. I tried to google the answer but no luck. I need to flatten 3d drawing. I know there is a FLATSHOT command which is doing the job well... the problem is I need to process a lot of drawings in batch and FLATSHOT pops up the dialog box... Other lisp routines which simply flatten the image are not good, because they keep "obscured" lines. In other words I need just 2d front view drawing of 3d object, no background lines etc. Please help :)