Jump to content
nocturne00

Flatten alternatives

Recommended Posts

nocturne00

Just a follow up to the inquiry on the Flatten command.

Is there a way to use set all entities in a drawing to elevation 0? like moving them all to Z=0

like the flatten command but all entities in one command including blocks, hatches, etc

 

TIA:D

Share this post


Link to post
Share on other sites
Cad64

I found this routine somewhere, years ago, and have been using it ever since. It works much better than the Flatten command.

 

 
(defun c:flat (/ total-nabor) 
(vl-load-com) 
(if 
(setq total-nabor (ssget "x" '((410 . "model")))) 
(progn 
(setq total-nabor 
(mapcar 'vlax-ename->vla-object 
(mapcar 'cadr 
(ssnamex total-nabor))) 
) 
(foreach i '(1e99 -1e99) 
(mapcar (function (lambda (x) 
(vla-move x 
(vlax-3d-point (list 0 0 0)) 
(vlax-3d-point (list 0 0 i))) 
)) total-nabor ))) 
) 
(princ) 
)

Share this post


Link to post
Share on other sites
nocturne00

wow, so nice, works like a charm :D

this sure beats the flatten command hehe.

 

ever experienced errors or bugs using it?

 

thanks bro

Share this post


Link to post
Share on other sites
Cad64

No, I don't think I've ever had any problems with it. I'm not saying it's perfect, but it's pretty good, and it has always worked for me. But I also know there's a first time for everything, so if you experience any problems with it, post back and maybe one of the lisp guys can sort it out.

Share this post


Link to post
Share on other sites
tzframpton

Good routine. I wonder if this will correct the "entities not coplanar" crap I have to deal with from time to time. That's the only time I use the FLATTEN command but I can't stand using it. It doesn't stay the same distance.

Share this post


Link to post
Share on other sites
nocturne00
"entities not coplanar"

 

Likewise,in civil 3d its so fraustrating to join or fillet plines end come up with "lines are not coplanar" result. when u check the line elevations you just get a + or -0.0026 line elevation, whats worse is almost half of the entire drawing is set to this elevation... really fraustrating :x

anyways, the lisp routine really works. will report any bugs if ever.

 

Thanks again :D

Share this post


Link to post
Share on other sites
skipsophrenic

just so i know (have been redirected here for an answer) once loaded do i just type the word "flat" in command bar?:unsure:

Share this post


Link to post
Share on other sites
Cad64

Yes, just type FLAT, hit Enter and the routine will do the rest.

Share this post


Link to post
Share on other sites
skipsophrenic

thnx, i'll give it a try

Share this post


Link to post
Share on other sites
skipsophrenic

sorted, cheers cad64,

Share this post


Link to post
Share on other sites
merdrignac

Try this button macro:

 

C^C_move;_all;;0,0,0;0,0,1e99;_move;_p;;0,0,0;0,0,-1e99;

 

Quick and simple

Edited by SLW210
Code Tags

Share this post


Link to post
Share on other sites
Scott44

Question on that routine. How do I put it to use? I've never set up commands before.

Share this post


Link to post
Share on other sites
Scott44

Makes perfect sense. I followed the directions. Copied and pasted it. put it in the same place where all my lisp routines are. So it's loading....But when I type "Flat" noting happens. Says it's an unknown command. Anyone have any idea what I might have done wrong?

Share this post


Link to post
Share on other sites
merdrignac

All depends on which version of Autocad you use. Is Building Systems an autocad varient?

Share this post


Link to post
Share on other sites
nocturne00

Yep its autoacad,,, better known as ABS (AutoCAD Building Systems)

It should work since it is basically still autoCAD based. all the basics of it are there...

Share this post


Link to post
Share on other sites
GE13579
Makes perfect sense. I followed the directions. Copied and pasted it. put it in the same place where all my lisp routines are. So it's loading....But when I type "Flat" noting happens. Says it's an unknown command. Anyone have any idea what I might have done wrong?

 

Did you save it as flat.lsp?

Share this post


Link to post
Share on other sites
nocturne00
No, I don't think I've ever had any problems with it. I'm not saying it's perfect, but it's pretty good, and it has always worked for me. But I also know there's a first time for everything, so if you experience any problems with it, post back and maybe one of the lisp guys can sort it out.

 

Hi Cad;

stumbled on a small glitch when using flat. i dont know if you already came accross this but it seems when I use the lisp it affects dynamic blocks. the command changes the Properties>Geometry>ScaleZ of the block to 0 and thus making the Dynamic block... non dynamic;(thanks to Ipseifer for figuring this out by the way)

all dynamic functions are not usable although in BEDIT the dynamic functions are still present, but not usable anymore unless the ScaleZ factor is changed to 1 :) .

 

Hope you guys can help me with this coz ive come to use this Lisp quite often now.

 

TIA

Share this post


Link to post
Share on other sites
merdrignac

The macro I posted was meant to be attached to a button on a button menu. You have to open customise, create a new command, and add the macro and apply. when you click on the button the command to reduce everything to zero in the z plane, is executed with no further imput required. For details on customising refer to Autocad 'Help'.

Hope that helps

Share this post


Link to post
Share on other sites
Morphix

Hello the script above works great.. however I am recieving the following error message:

 

; error: Automation Error. Not allowed for this proxy

 

Any ideas ? :D

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...