Jump to content

Solids to Mesh LISP


raymarcher

Recommended Posts

I made some scripts to work with solids.

The first three work but the third to turn a solid into a mesh with meshsnmooth does not work.

Can somebody help?

 

SOLIDS ERASE 

(
(setvar "qaflags" 1)
(setq SolidsErase (ssget "X" '((0 . "3dsolid"))))
(command "ERASE" SolidsErase "")
(setvar "qaflags" 0)
)


SOLIDS OFFSET BASE POINT

(
(setvar "qaflags" 1)
(setq SolidsOffset (ssget "X" '((0 . "3dsolid"))))
(command "MOVE" SolidsOffset "" "0,0,0" "5,5,0")
(setvar "qaflags" 0)
)


SOLIDS OFFSET DISPLACEMENT

(
(setvar "qaflags" 1)
(setq SolidsOffset (ssget "X" '((0 . "3dsolid"))))
(command "MOVE" SolidsOffset "" "" "2,2,2")
(setvar "qaflags" 0)
)


SOLIDS TO MESH

(
(setq SolidsToMesh (ssget "X" '((0 . "3dsolid"))))
(command "MESHSMOOTH" SolidsToMesh "")
)

 

Thanks a lot

Link to comment
Share on other sites

Try this:

 

(vl-load-com)
(vla-SendCommand
   (vla-get-ActiveDocument (vlax-get-acad-object))
   (strcat "MESHSMOOTH" " " "(ssget \"X\" '((0 . \"3dsolid\")))" " " " ")
)

Link to comment
Share on other sites

Is it necessairy ti use visual lisp?

I wanted to keep things simple in an autolisp.

 

On this side (tested only in AutoCAD 2010), the

(setq SolidsToMesh (ssget "X" '((0 . "3dsolid"))))
(command "MESHSMOOTH" SolidsToMesh "")

Works as expected.

 

Henrique

Link to comment
Share on other sites

(setq SolidsToMesh (ssget "X" '((0 . "3dsolid"))))
(command "MESHSMOOTH" SolidsToMesh "")

 

 

(setq SolidsToMesh (ssget "X" '((0 . "3dsolid"))))
(command "MESHSMOOTH" SolidsToMesh "")

 

 

Henrique, the code is the same.

It doesn't works on my A2014.

Edited by GP_
Link to comment
Share on other sites

Henrique, the code is the same.

It doesn't work on my A2014.

 

 

Hi GP,

 

 

I know that the code is the same, I was just saying to OP that is code worked as expected in AC2010...

After your reply, I did test the OP code in another machine with AC2012 and AC2014, and work ok in all versions...

 

 

Henrique

Link to comment
Share on other sites

Hy Henrique,

 

in my AC2014 the OP's code works only with primitive solids.

 

Gian Paolo,

 

I did only tested with primitive solids... :oops:

 

In AC2014 and without primitive solids, only with the vla-SendCommand as you had suggested, worked ok.

 

Cheers

Henrique

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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