[Closed] Trace imported CAD lines
Hey there,
I’ve been thinking about a tool to ease the tracing of CAD data.
In our workflow we receive CAD data from architects which we have to strip in AutoCAD then import and then trace with splines to create something we can use in MAX.
I’ve been doing this for over two years now and decided enough is enough with this tedious work.
So im really just asking for a brain storm really. Im the only one in my office who plays with MAXscript so i kinda want to bounce some ideas around.
I’ve been looking into creating splines. but not sure how i can interpret the CAD data, I know i probably would depend on the cleanliness of that data but that is something we would have to contend with in AutoCAD before hand.
Any ideas would be great.
Cheers guys and gals
I know your pain as we are doing the same… One idea to improve this would be a tool similar to the “BPOLY” command in autocad which creates a polygon based on the closed area you clicked in. This might not be that hard to do but I am not sure where to start…
The best way would be to “project” all the plan into ONE plane, creating ONE line only in each given location. (Because a lot of times you have multiply lines one on top of the others.)
Than , giving a Treshold different for every plan, weld the lines at corners and where they must be continuos.
That is not a “bullet-proof” method, but often it works for me when I want to automate the process …
Edit
By saying weld, I mean create the continuation of a line until it meets the other one, without moving any vertex from it’s location in space…not exactly welding, but you get the idea…
Edit
I’ve found a few examples of previous or similar attempts.
Bobo’s shape scape which looks at bitmaps and trace’s the image based on a threshold setting.
also
Marc Lorenz produced an ArchiCAD import wizard which i imagine would do something similar
unfortunately he as encripted his script.
Krembo99 what do you mean by “project” ? I do understand the need to simplify the AutoCAD as in many cad documents there are multiply lines on top of each other.
what i mean is to “flatten” the drawing by “projecting” it on an imaginary plane.
That way you resolve 2 problems, multiply lines, AND lines that are goin from one z to another (another common problem with autocad drawings made by novices)
There are several autocad command to do so, like solview and soldraw or flatshot(r2007 and later) – rhinoceros has a built in command to do so on plane, sphere and evry solid actually.
I have this flatter LSP routine i took somewhere on the web …
(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)
) ;_ end of mapcar
) ;_ end of mapcar
) ;_ end of setq
(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))
) ;_ end of vla-move
) ;_ end of lambda
) ;_ end of function
total-nabor
) ;_ end of mapcar
) ;_ end of foreach
) ;_ end of progn
) ;_ end of if
(princ)
) ;_ end of defun
Although this isn’t a complete solution – its easier to get all objects on one plane in Autocad using a combination of the FLATTEN and OVERKILL commands (used to be part of express tools). Overkill in particular is really good and deals with fuzzy logic of bad draftsmanship quite well – deleting duplicate lines and rebuilding plines.
Once the dwg is in Max you can script looping through the splines changing the Z coordinate of each vertex to get everything on one plane.
The are also plugins like OptimiseSpline which make a reasonable job of simplifying curves (eg millions of verts on splines out of microstation).