Jump to content

Convert multiple lines and blocks with Z axis coordinates to Z=0 for all elements


KBGROSSRA

Recommended Posts

Somehow a drawing I thought was in 2D had numerous lines and objects that were 3D with various Z axis points. Can't get everything back to Z=0 using flatten command. Setting each item to Z=0 moves them to some other part of the drawing.

Link to comment
Share on other sites

This is my first attempt on CADTutor, so hope it works.

It is a 5MB file, and the limit seems to me 1MB. Even deleting many parts of the sections, it is still at 4MB+.

Link to comment
Share on other sites

That is huge. Maybe you can strip it down to just a small portion that exhibits the behavior. We don't really need the entire file, just part of it to illustrate what you are talking about.

Link to comment
Share on other sites

Yes, we have some intrinsic issue with our files. When we start a new drawing, we usually use a similar one from a previous project and even without linework, they are huge. We used to have a command in earlier versions of ACAD that was labeled "layer filter delete" that seemed to break the connections to old drawings that we haven't bee able to recreate in our newer versions. We used to have someone who was very knowledgeable in ACAD then, but not now.

Link to comment
Share on other sites

We use a more specific approach making known objects to z=0. Flatten tried to make Civ3D cogo points to z=0 ?

 

they are huge
You need to look at the dwg carefully it sounds to me like you have blocks that are say dwg's inside your dwg, as a test do purge and saveas something else. We have various purge routines that only do say certain clean up PURGE Layers road* etc. We have block library rather than all blocks in the template.

 

; changes all level to zero
(vl-load-com)
(defun dxf(code elist)
(cdr (assoc code elist))
)
(defun circ0 (/ g n lg e os ns el nl)
(princ "\nChanging CIRCLES: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "CIRCLE"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun line0 (/ g n lg e os ns of nf el nl)
(princ "\nChanging LINES: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "LINE"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
(setq of (assoc 11 e))
(setq nf (list(car of)(cadr of)(caddr of) 0.0))
(setq e (subst nf of e))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun arc0 (/ g n lg e os ns el nl)
(princ "\nChanging ARCS: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "ARC"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
) 
(defun sol0 (/ g n lg e o1 n1 o2 n2 o3 n3 o4 n4 el nl)
(princ "\nChanging SOLIDS:" )
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "SOLID"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq o1 (assoc 10 e))
(setq n1 (list(car o1)(cadr o1)(caddr o1) 0.0))
(setq e (subst n1 o1 e))
(setq o2 (assoc 11 e))
(setq n2 (list(car o2)(cadr o2)(caddr o2) 0.0))
(setq e (subst n2 o2 e))
        (setq o3 (assoc 12 e))
(setq n3 (list(car o3)(cadr o3)(caddr o3) 0.0))
(setq e (subst n3 o3 e))
        (setq o4 (assoc 13 e))
(setq n4 (list(car o4)(cadr o4)(caddr o4) 0.0))
(setq e (subst n4 o4 e))
        (setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun text0 (/ g n lg e os ns of nf el nl)
(princ "\nChanging TEXT: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "TEXT"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
        (setq of (assoc 11 e))
(setq nf (list(car of)(cadr of)(caddr of) 0.0))
(setq e (subst nf of e))
        (setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun pt0 (/ g n lg e os el nl)
(princ "\nChanging POINTS: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "POINT"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
        (setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun dim0 (/ g n lg e o1 n1 o2 n2 o3 n3 o4 n4 o5 n5 o6 n6 o7 n7 el nl)
(princ "\nChanging DIMS: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "DIMENSION"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq o1 (assoc 10 e))
(setq n1 (list(car o1)(cadr o1)(caddr o1) 0.0))
(setq e (subst n1 o1 e))
(setq o2 (assoc 11 e))
(setq n2 (list(car o2)(cadr o2)(caddr o2) 0.0))
(setq e (subst n2 o2 e))
        (setq o3 (assoc 12 e))
(setq n3 (list(car o3)(cadr o3)(caddr o3) 0.0))
(setq e (subst n3 o3 e))
        (setq o4 (assoc 13 e))
(setq n4 (list(car o4)(cadr o4)(caddr o4) 0.0))
(setq e (subst n4 o4 e))
(setq o5 (assoc 14 e))
(setq n5 (list(car o5)(cadr o5)(caddr o5) 0.0))
(setq e (subst n5 o5 e))
        (setq o6 (assoc 15 e))
(setq n6 (list(car o6)(cadr o6)(caddr o6) 0.0))
(setq e (subst n6 o6 e))
        (setq o7 (assoc 16 e))
(setq n7 (list(car o7)(cadr o7)(caddr o7) 0.0))
(setq e (subst n7 o7 e))
        (setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun pline0 (/ g n lg e os ns el nl ed en)
(princ "\nChanging PLINES and DONUTS: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "POLYLINE"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
(SETQ en (DXF -1 e)) 
(while (and (setq en (entnext en))
(SETQ ED (ENTGET EN))
(/= "SEQEND" (dxf 0 ed))
)
(progn
(setq os (assoc 10 ed))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq ed (subst ns os ed))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod ed)
)
)
(entupd en)
)
)
(setq n (1+ n))
)
))
)
(defun lwpline0 ( / ss num x)
(setq ss (ssget "P"))
(setq num (sslength ss))
(setq x num)
(repeat num
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(if (= (vla-get-objectname obj) "AcDbPolyline")  
(vla-put-elevation obj 0.0)
)
)
)

(defun ins0 (/ g n lg e os ns el nl)
(princ "\nChanging BLOCK INSERTS: ")
(setq g (ssget "P"))
(if g (progn
(setq n 0 lg (sslength g))
(while (< n lg)
(if (= "INSERT"
(cdr (assoc 0 (setq e (entget (ssname g n))))))
(progn
(setq os (assoc 10 e))
(setq ns (list(car os)(cadr os)(caddr os) 0.0))
(setq e (subst ns os e))
(setq el (assoc 38 e))
(setq nl (cons 38 0.0))
(setq e (subst nl el e))
(entmod e)
)
)
(setq n (1+ n))
)
))
)
(defun c:zero ()
(setq g (ssget))
(circ0)
(line0)
(arc0)
(sol0)
(text0)
(pt0)
(dim0)
(pline0)
(lwpline0)
(ins0)
(princ)
)

Link to comment
Share on other sites

Steven-g, what is the process you go through to achieve this? I explode the blocks with thickened objects, run flatten command and nothing changes. Could I send you more elevations? I'm afraid my ACAD skills are too basic.

Thank you.

Link to comment
Share on other sites

Thanks BigAl, I posted one of my drawings which you can look at. The blocks inside the drawing aren't that complex. It seems to have more with inherited layer filters that are hidden.

Link to comment
Share on other sites

Flatten doesn't work for thickness. To do that I used the qselect command to find all lines with a thicness not equal to zero, and changed it to zero in the properties palette, then the same again for polylines. For finding the correct blocks to explode I turned the view to front view and the objects not at zero should show up.

Link to comment
Share on other sites

KBGROSSRA dwg is where ?

 

Thickness is probably a variable that started with Autocad and is a poor mans 3D you can have both thickness and a Z or elevation on a object, rather than flatten the block objects it be to only set ELEV to zero.

 

This is two lines

Select objects:

 

LINE Layer: "0"

Space: Model space

Thickness = 2400.000

Handle = 606d

from point, X= 6685.930 Y= 2745.541 Z= 5000.000

to point, X= 9342.205 Y= 2501.736 Z= 5000.000

Length = 2667.440, Angle in XY Plane = 354d45'21"

Delta X = 2656.275, Delta Y = -243.805, Delta Z = 0.000

 

LINE Layer: "0"

Space: Model space

Thickness = 2400.000

Handle = 606b

from point, X= 6685.930 Y= 3161.445 Z= 0.000

to point, X= 9342.205 Y= 2917.639 Z= 0.000

Length = 2667.440, Angle in XY Plane = 354d45'21"

Delta X = 2656.275, Delta Y = -243.805, Delta Z = 0.000

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...