style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"JMongi5967" <Does
href="mailto:jmongi5967@aol.com">jmongi5967@aol.com> wrote in message
href="news:f08048c.-1@WebX.maYIadrTaRb">news:f08048c.-1@WebX.maYIadrTaRb...
anyone have a lisp routine or a way to convert 2D solid objects to a closed
polyline. Or at least a way to draw a polyline around the perimeter of the 2D
solid object. Any help would be appreciated.
bumping an old thread...hoping for new info
same issue
(i have a converted .dgn that has solids in it representing columns that i'd like to make outlines)
but using autocad lt for mac 2013
is there a command now that allows a 2d solid to be converted to a polyline? or even just line entities?
thanks up front!
adam
Hi Adam,
firstly, I'm not a LT guy nor a mac user...
I think AutoCAD LT have the 'region' command ( LT help files have the command ), if so, you can use the region command to convert the solid objects to regions, then explode the regions to lines.
Hope that helps
Henrique
hmsilva, thanks for your suggestion
it unfortunately didn't work for me
"region" is in LT, but didn't do what you'd hoped...
it just gave me "0 regions created"
Adam
[edit] just found it
explode the solid
THEN, region the remaining solid to get the polyline
so, THANKS MUCH! in the end!
Hello everybody,
First of all, I'm really sorry for bumping this old thread, so please forgive me.
For a current project, I've got drawings that use solid objects (called "Körper" in the German installation of AutoCAD I use) as floor plan contours. I'd like to convert these objects to lines or polylines.
I initially found the listing at:
http://autocadtips1.com/2013/12/28/autolisp-convert-2d-solid-to-polyline-outline/
I loaded the LISP file above into AutoCAD Architecture 2015. When entering the outlinesolid command, it will show an error message:
Aufrufen von (command) aus *Fehler* nicht möglich, ohne vorheriges Aufrufen von (*push-error-using-command*). Konvertieren von (command)-Aufrufen in (command-s) wird empfohlen.
Unfortunately I can't simply explode these solids.
I've also tried some of the listings found here:
But they did not work for me, since they resulted in the same error message
Any help will be highly appreciated.
Kind regards.
@Maruku wrote:
Hello everybody,
First of all, I'm really sorry for bumping this old thread, so please forgive me.
For a current project, I've got drawings that use solid objects (called "Körper" in the German installation of AutoCAD I use) as floor plan contours. I'd like to convert these objects to lines or polylines.
I initially found the listing at:
http://autocadtips1.com/2013/12/28/autolisp-convert-2d-solid-to-polyline-outline/
I loaded the LISP file above into AutoCAD Architecture 2015. When entering the outlinesolid command, it will show an error message:
Aufrufen von (command) aus *Fehler* nicht möglich, ohne vorheriges Aufrufen von (*push-error-using-command*). Konvertieren von (command)-Aufrufen in (command-s) wird empfohlen.Unfortunately I can't simply explode these solids.
I've also tried some of the listings found here:
But they did not work for me, since they resulted in the same error message
Any help will be highly appreciated.
Kind regards.
Hello Maruku and welcome to the Autodesk Community!
If possible attach a sample dwg with one or two "Körper".
Henrique
@G_WIDER wrote:
Hallo Henrique,
attached an example file named "koerper.dwg".
Thanx Forehand for any hint.
Best regards
George
Hello George,
try this...
;; by Jeff Mishler ;; http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/convert-solid-to-hatch/m-p/1218153#M170723 (defun get_space () (if (= (getvar "cvport") 1) (vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object))) (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) ) ) (defun convert2dsolids (/ 2dcoords coords count hatch obj pline space ss) (and (setq ss (ssget '((0 . "SOLID")))) (setq count -1) (setq space (get_space)) (while (< (setq count (1+ count)) (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss count))) (setq coords (vlax-get obj 'coordinates)) (setq 2dcoords (list (car coords) (cadr coords))) (setq coords (cdr (cdr (cdr coords)))) (setq 2dcoords (append 2dcoords (list (car coords) (cadr coords)))) (setq coords (cdr (reverse (cdr (cdr (cdr coords)))))) (setq 2dcoords (append 2dcoords (list (cadr coords) (car coords)))) (setq coords (reverse coords)) (setq 2dcoords (append 2dcoords (list (car coords) (cadr coords)))) (setq pline (vlax-invoke space 'addlightweightpolyline 2dcoords)) (vla-put-closed pline :vlax-true) ;(setq hatch (vlax-invoke space 'addhatch acHatchPatternTypePredefined "SOLID" :vlax-true)) ;(vlax-invoke hatch 'appendouterloop (list pline)) (vla-put-color pline (vla-get-color obj)) ;(vla-put-color hatch (vla-get-color obj)) (vla-put-layer pline (vla-get-layer obj)) ;(vla-put-layer hatch (vla-get-layer obj)) (vla-delete obj) ) ) ) (defun c:cd () (convert2dsolids) (princ))
Hope this helps,
Henrique
Hi Henrique,
thank you very much. I will try it next time. Meanwhile a got a hint of Alfred he reaired my old version to this new one:
;;; Select a 2D solid and this will delete the solid and replace its outline with a polyline
;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Solid-object-to-Polyline/td-p/783079
;;; Posted By: Schamenek, Alex
(defun c:outlinesolid(/ solid pt1 pt2 pt3 pt4)
(prompt "\nPlease select the solid you want to outline.")
(WHILE (NOT (setq solid (ssget "_:S:E" '((0 . "SOLID")))))
(prompt "\nPlease select the solid you want to outline."))
(SETQ pt1 (cdr (assoc 10 (entget (ssname solid 0))))
pt2 (cdr (assoc 11 (entget (ssname solid 0))))
pt3 (cdr (assoc 12 (entget (ssname solid 0))))
pt4 (cdr (assoc 13 (entget (ssname solid 0))))
);SETQ
(COMMAND "_.PLINE" PT1 PT2 PT4 PT3 "_C")
(command "_.erase" solid "")
);DEFUN
That is working also fine because he corrected following Sequenz:
Old: (ssget ":S" '((0 . "SOLID") to
New: (ssget "_:S:E" '((0 . "SOLID")
I attached it as a file. Now it is working fine in every language.
Thank you very much
George
Solutions offered so far have some drawbacks that I notice [except @hmsilva's offering from Jeff Mishler in Post 14 doesn't have all of them]:
They [except Jeff's] can be thrown off by running Osnap modes.
For 3-sided Solids, they result in Polylines with coincident vertices, which can cause problems with certain other operations and custom routines. 3-sided ones have two causes: from hitting Enter when asked for the 4th corner, in which case the 3rd & 4th [the 12- & 13-code entries in entity data] are the same; or from continuing in the SOLID command after making a 3-sided one like that, in which case the 1st & 2nd [the 10- & 11-code entries] are the same, since in continuations, those coincide with the 12- & 13-code entries of the previous Solid.
It takes two U's to undo them [one to undo the Erasing of the Solid, and one for the drawing of the Polyline perimeter]. Jeff's has a variant problem, since it doesn't use (command) functions but has no Undo begin/end wrapping -- if you use U right after doing it, the Polylines all revert back to their original Solids AND the last command before that is also undone!
They [except Jeff's] allow selection of only one Solid per running of the command.
They allow selection of Solids on locked Layers, so they can then draw the Polyline perimeter, but can't erase the Solid. In Jeff's with multiple selection, if any Solid on a locked Layer is not the last one in the selection, it won't convert any others after it runs into the error about the locked one.
They don't have *error* handling.
Attached is SolidsToPolylines.lsp with its S2P command, which overcomes all of those drawbacks. See further comments in the file.
@mehboob.ali wrote:
I want to convert 3d solid (pipe) to 3d lines any lisp there to do ?
This is about 2D Solid objects, those made with the SOLID command, which are an entirely different animal from 3D Solids. I suggest you Search the Forums first, and if you don't find anything like what you want, start a new thread. In it, describe [or include an image or sample drawing showing] in what way you would want "3d lines" to represent the original pipe shape [parallel along the surface? how many? inside and outside? include something at the ends, and if so, Circles rather than lines? etc.], and also what "3d lines" should be [ordinary Lines? 3DPolylines? something else?].
Hi
I am trying to use this lisp routine, but it somehow returns wrong coordinates, thus drawing the outlines somewhere else in the drawing.
Also weird that some it is not even a constant offset, but some outlines are drawn the right distance from one another, but others are completely at a different location.
I included a screencast.
I also checked one vertex of a solid and the properties bar says the coordinates are:
-101421,63 59591,75
While the lisp routine for the same solid vertex returns:
319131,0 620230,0
Would greatly appreciate some help.