Problem with LISP routine for 3D Solids to 3D faces cleanup in AutoCAD

Problem with LISP routine for 3D Solids to 3D faces cleanup in AutoCAD

Anonymous
Not applicable
848 Views
0 Replies
Message 1 of 1

Problem with LISP routine for 3D Solids to 3D faces cleanup in AutoCAD

Anonymous
Not applicable

I took another look at my problem today and managed to get a solution working. 

 

Capture.PNG

 

I only have one annoyance with the lisp. I'm using a modified version of the code found here: https://www.theswamp.org/index.php?topic=52160.msg571599#msg571599

 

My issue is that in order to make my cleanup code work, I need to add an additional block of code between the user selecting the 3DSOLIDS and the VLA-Sendcommand firing the code to convert the 3DSOLIDS into 3DFACES. I realize that my issue lies with (setq solids (entlast)) and the way the meshes are generated using _Previous and (entnext ..). I tried a few different ways to get it to work but only really had success by recreating the 3DSOLID selection set after my additional processing. I probably don't need the ability to select specific 3DSolids and would be fine using "_X" rather than "_:L" in the ssget calls, but would like to have the code working with the ability to choose select solids. 

 

	(prompt "\nSelect 3DSOLIDS to convert to 3DFACES...")
	(setq solids (ssget "_:L" '((0 . "3DSOLID"))))
	(while (not solids)
		(prompt "\nMissed... Select 3DSOLIDS to convert to 3DFACES again...")
    	(setq solids (ssget "_:L" '((0 . "3DSOLID"))))
	)

	;; Perform some additional processing here where new objects/selection sets are generated
	(command "._XEDGES" solids "")
	(setq curves (ssget "_X" '((-4 . "<OR")(0 . "ARC")(0 . "CIRCLE")(-4 . "OR>"))))

	;; VLA Code only works if this is repeated after the additional processing above
	(setq solids (ssget "_:L" '((0 . "3DSOLID"))))

	(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "(setq solids (entlast))\n_.MESHSMOOTH\n_Previous\n\n(while (setq solids (entnext solids))....

 

 

Is there a way to re-generate the same selection set that the user creates manually at the beginning of the lisp automatically so that the user doesn't have to duplicate their actions selecting the same 3DSOLIDS twice every time the lisp is run? Alternatively, if I'm just a dumb dumb and the solution to getting the code in vla-sendcommand to work is simple, I'd appreciate the help!

 

[This post has been split from another thread and the title updated for clarity by cheryl.buck]

 

0 Likes
849 Views
0 Replies
Replies (0)