convert 3D solid to 3D faces with LSP program.

convert 3D solid to 3D faces with LSP program.

Anonymous
Not applicable
4,982 Views
8 Replies
Message 1 of 9

convert 3D solid to 3D faces with LSP program.

Anonymous
Not applicable

I placed a pline to make a box, extrude it to became 3Dsolid, and want to convert 3D solid to 3D faces. I ran codes below, but sometime it converted and other time it didn't. Anyone has a suggestion that I can try?

 

codes:

 

 (prompt "\nSelect 3D solid to convert: \n")
 (setq 3D_ENT (car (entsel)))

 (command "convtosurface" 3D_ENT "")
 (vla-SendCommand
    (vla-get-ActiveDocument (vlax-get-acad-object))
    (strcat "UNION" " " "(ssget \"L\")" " " "\r")
 )
 (vla-SendCommand
    (vla-get-ActiveDocument (vlax-get-acad-object))
    (strcat "MESHSMOOTH" " " "(ssget \"P\")" " " "\r")
 )

 (vla-SendCommand
    (vla-get-ActiveDocument (vlax-get-acad-object))
    (strcat "explode" " " "(ssget \"L\")" " " "\r")
 )

 

0 Likes
Accepted solutions (1)
4,983 Views
8 Replies
Replies (8)
Message 2 of 9

SeeMSixty7
Advisor
Advisor
Looking ta your code I think all you want to do is.
(defun c:QUICK()

(setq 3D_ENT (car (entsel "\nSelect Solid")))
(if 3D_ENT ; We are assuming you picked a solid
(progn
(command "CONVTOSURFACE" 3D_ENT "")
(command "UNION" (entlast) "")
(command "MESHSMOOTH" (entlast) "")
(command "EXPLODE" (entlast))
); progn
);if
);defun

good luck
0 Likes
Message 3 of 9

Anonymous
Not applicable
I tested but got same result (like no change/nothing happened at line: (command "MESHSMOOTH" (entlast) "")). I'll check of other solutions. Thanks for taking time to help me out.

[KI]

TONY YANG | CAD PROGRAMMER/ANALYST

P: 920.468.2609 | E: tony.yang@ki.com | ki.com


[Facebook]

[Twitter]

[Youtube]

[LinkedIn]

[Pinterest]

[Instagram]


[KI - Fixed Seating]



________________________________

As a trusted market resource, KI furnishes more than furniture. We furnish knowledge. www.ki.com

This e-mail, including attachments, is intended solely for the person or entity to which it is addressed and may contain
confidential, privileged and/or proprietary information. Any review, dissemination, distribution, copying, printing, or other
use of this e-mail by persons or entities other than the addressee or his/her authorized agent is prohibited. If you have
received this e-mail in error, please contact the sender immediately and delete the material from your computer.
0 Likes
Message 4 of 9

Ranjit_Singh
Advisor
Advisor

I don't know why you need union. Union needs 2 entities. Try this. Create the 3d solid, explode to turn into regions, call meshsmooth to convert regions to mesh and finally call explode again to convert mesh to 3d faces.

0 Likes
Message 5 of 9

marko_ribar
Advisor
Advisor

@SeeMSixty7 wrote:
Looking ta your code I think all you want to do is.
(defun c:QUICK()

(setq 3D_ENT (car (entsel "\nSelect Solid")))
(if 3D_ENT ; We are assuming you picked a solid
(progn
(command "CONVTOSURFACE" 3D_ENT "")
(command "UNION" (entlast) "")
(command "MESHSMOOTH" (entlast) "")
(command "EXPLODE" (entlast))
); progn
);if
);defun

good luck

MESHSMOOTH command won't work in (command ...) calls, instead OP guessed correctly by using it inside (vla-sendcommand) call...

 

Look here for my reply :

https://www.theswamp.org/index.php?topic=52160.msg571599#msg571599

 

HTH, M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 6 of 9

Matt__W
Advisor
Advisor
Accepted solution

Thanks for posting here @marko_ribar (and at TheSwamp). I was hoping I wasn't missing something with regards to the MESHSMOOTH command. Seems I was on the right path all along. Thanks for confirming I wasn't losing my mind.  🙂



Matt Wunch
Revit Subject Matter Expert/sUAS Pilot

Twitter | LinkedIn

AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models

Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.

0 Likes
Message 7 of 9

curro1968
Explorer
Explorer

Hello!

 

I am looking for a LISP to convert 3D solids to 3DFACEs. I cannot use CONTOSURFACE - MESHSMOOTH - EXPLODE because it doesn´t generate 3DFACEs but REGIONs. I need the 3DFACEs (including their INVISIBLE edges) to use them for a dinamic block. In particular, I want to get a dinamic window frame, with their WIDTH and HEIGHT adjustable.

 

So, if you know any LISP routine to get that, please, tell me. Thanks a lot in advance!

 

P.S. I attach an example DWG

0 Likes
Message 8 of 9

marko_ribar
Advisor
Advisor

Generally speaking, if you get REGIONS up to 4 vertices, you can further EXPLODE it into LINES... Collect 4 different points, remove LINES and create 3DFACES like you wanted - making object stretchable... But I don't quite know why you need assistance, you could have imagined this already very fast...

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 9 of 9

curro1968
Explorer
Explorer

Yes, I knew that...

 

I needed it to get a 3DFACE surface stretcheable for a dinamic block. I need to explode nothing but making a clone from the 3D SOLID with 3DFACEs and erase the 3D SOLID after that.

 

If a LISP routine could automatize that process it would be much faster and with no risk of orienting the 3DFACEs in bad mode

 

That's the Matter!

 

 

 

0 Likes