PDA

View Full Version : How to set Z coordinates to 0.



zab
2007-03-20, 02:12 AM
i got a problem when lot of my lines not align well, (ex.z=0,0003) i found this when i try to put my base point (intersection). I need easy & faster way to select all lines put it in correct (z=0.000) . F1....pls

mmccarter
2007-03-20, 08:03 AM
I will pass up this very easy opportunity to enter into one of my rants on this subject like I usually do! :D

In short, there is currently no easy solution which works flawlessly to accomplish this. Some people will claim that things such as moving all objects about 0,0,0 to 0,0,1e99 and then about 0,0,0 back to 0,0,-1e99 will work but I have found this to totally change the geometry of some objects and move others to literally miles away from where the rest of the data is.
The flatten command will work on some objects, but if you have one single object which will not flatten then the command annoyingly does not run at all.
You could always use the properties tab and change objects z value to 0 in there (on lines with different z values only the first vertex will be put to 0 and the rest of the geometry will remain relative as the original)

Oooops, I said I wasn't going to go off on one lol. Appologies.

Richard McDonald
2007-03-20, 08:50 AM
There really is know easy way. The flatten lisp off the Augi exchange is better than the autodesk one but still wont work on 3dpolys. Use the quick select button on the properties tool bar to select lines that don't have z=0. I spent half a day doing this yesterday.

Check your drawing completely as I've had strange things happen before now with end points moving.

mmccarter
2007-03-20, 11:13 AM
Fastest way to do this is to use a copy of Microstation if you can get your hands on one and convert to 2d in there or import the dwg to a 2d seed file.

Mlabell
2007-03-20, 12:05 PM
Fastest way to do this is to use a copy of Microstation if you can get your hands on one and convert to 2d in there or import the dwg to a 2d seed file.Hint, Microstation = blasphemy to AUGI people. ;)

Use quickselect, then select lines (if this the case) "Start Z" as properties "Not Equal" as operator "0.000000" as a value. Do the same for "end z". Enclosed are some screen captures to help.

Also from autodesk (http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2875571&linkID=9240617) ...

Cadtharsis
2007-03-20, 02:05 PM
If you have express tools:
Object ---> Modify ---> Flatten

Works great for me.

Richard McDonald
2007-03-20, 02:51 PM
Did I read somewhere that saving as a R12 .DXF file will flatten things or was that to cure something else.

Mlabell
2007-03-20, 02:58 PM
Did I read somewhere that saving as a R12 .DXF file will flatten things or was that to cure something else.I know r12 had 3dpolylines... Actually if anyone cares r10 was the introduction to 3d polylines. I just tried using dxfout to r12 and the 3dpoly still has z elevations. So I don't think that works.

moshira_hassan
2007-03-21, 07:09 AM
I I just tried using dxfout to r12 and the 3dpoly still has z elevations. So I don't think that works.
using flattern or zero lisp commands changes everything to Z0 except : splines and plines that should be exploded first ...
So, using dxf r12 is just to explode splines ( which are not able to be exploded with the simple explode command) in order to be able to change it's coordinates with any of the ways suggested in this thread...
when changing Z coordinate for a block into zero .. only it's insertion point is set to the new coordinates ... u should redefine it and apply zero command into it's object in order to have a complete flat drawing.

mmccarter
2007-03-21, 08:20 AM
Hint, Microstation = blasphemy to AUGI people. ;)



Well if there was a method which worked I would not have to use Microstation (which I hate using) everytime I need to carry this process out. Trust me, I have spent days and days investigating different techniques to convert drawings to flat 2d from 3d data. i have tried every method ever mentioned on AUGI, tried numerous externally written lsp's and have yet to find a way to do this.

All of the methods people have mentioned above work in SOME situations but there is still no proper all in one method to do this. The express tool flatten is incredibly touchy with what will and won't work for it.

I just had a brainwave last night about how to do this in the future possibly.
AutoCAD 2008 has the facilty to import/export Microstation .dgn files. One of the options in this is to select a "seed file", one of which is a 2d seed file. I would be interested to hear from anyone who has 2008 to try and export a 3d autocad file (preferably with splines, 3dpolylines, solids etc in it) using a 2d seed file and then import that 2d .dgn file back into AutoCAD.

In theory this should work perfectly without the need to use Microstation aswell! :D

jaberwok
2007-03-21, 01:26 PM
Does anyone still have a copy of the old "project.lsp" that used to be supplied with vanilla acad? If so, has anyone tried it on drawings containing modern object types?

Still a possibility?

Mlabell
2007-03-21, 01:32 PM
Still a possibility?I have it, but am I allowed to post it since it is "sacred code"?

jaberwok
2007-03-21, 01:36 PM
I have it, but am I allowed to post it since it is "sacred code"?

Have you tried it on a recent drawing?

"Sacred code"? - it was supplied as a support/example item.
Don't know if that would cause a problem. :-(

Mlabell
2007-03-21, 01:55 PM
Have you tried it on a recent drawing?

"Sacred code"? - it was supplied as a support/example item.
Don't know if that would cause a problem. :-(To backup your thoughts the project.lsp works. Now we need to get a mod to verify the presumptions about the code...

BrenBren
2007-03-21, 02:02 PM
To backup your thoughts the project.lsp works. Now we need to get a mod to verify the presumptions about the code...This was code that was originally supplied with AutoCAD? Let me know the details, and I'll check and find out if it can be posted

Mlabell
2007-03-21, 02:33 PM
This was code that was originally supplied with AutoCAD? Let me know the details, and I'll check and find out if it can be postedHere is what the beginning of the lisp states...


;;; PROJECT.LSP / Release 10 or 11
;;; (C) Copyright 1988-1992 by Autodesk, Inc.
;;;
;;; This program is copyrighted by Autodesk, Inc. and is licensed
;;; to you under the following conditions. You may not distribute
;;; or publish the source code of this program in any form. You
;;; may incorporate this code in object form in derivative works
;;; provided such derivative works are (i.) are designed and
;;; intended to work solely with Autodesk, Inc. products, and
;;; (ii.) contain Autodesk's copyright notice "(C) Copyright
;;; 1988-1992 by Autodesk, Inc."
;;;
;;; AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
;;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MER-
;;; CHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
;;; DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
;;; UNINTERRUPTED OR ERROR FREE.

BrenBren
2007-03-21, 03:14 PM
Here is what the beginning of the lisp states...Uh... yep, you can NOT post that here... sorry..

mmccarter
2007-03-21, 04:46 PM
Arrgh!!

Are you telling me there is a bit of holy code out there which would achieve the holy grail of proper drawing flattening/converting 3d to 2d?

FOR SALE:1 left arm, slightly used! :D

Mlabell
2007-03-21, 06:07 PM
Arrgh!!

Are you telling me there is a bit of holy code out there which would achieve the holy grail of proper drawing flattening/converting 3d to 2d?

FOR SALE:1 left arm, slightly used! :DIndeed, and it seems Autodesk has left it in the vault for some reason or another... Wish I knew why but I am sure glad that we keep everything here...:mrgreen:

jaberwok
2007-03-21, 07:52 PM
Thanks for checking that out Mark.
(I think the last time I used that was probably in R12).

The header includes -
"You may incorporate this code in object form in derivative works
provided such derivative works are (i.) are designed and
intended to work solely with Autodesk, Inc. products, and
(ii.) contain Autodesk's copyright notice "(C) Copyright
1988-1992 by Autodesk, Inc."

I'm not sure what they meant by "in object form" but a derivative work could, presumably, include putting a bit of wrapping around it and maybe changing the function name?

tedg
2007-03-21, 08:33 PM
Heres a routine I've had kicking around since R14.


(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)


It works a bit like the flatten command.
Still works for me,in most cases.

mmccarter
2007-03-22, 12:09 PM
Thanks for posting that code tedg. AS you state, it works on some stuff but unfortunately I could not get it to work on 3d polylines, arcs drawn on non flat ucs, solids.
I didn't try anything beyond this as these are the primary objects we work with.