Jump to content

LISP and Object Type 'Solid'


Haggbakk

Recommended Posts

Hi,

I work with both Tekla Structures and AutoCAD2008. When exporting drawings from TS to AutoCAD the Solid hatch is generated as Object type 'Solid'. I have used Qselect to find all solid objects in the drawings and changed their color to 253. It works, but it takes time.

 

I'm looking for a lisp that can do this for me. I've searched on this and other forums, but haven't found any lisp that finds 'Solid' object types.

 

My Lisp knowledge is unfortunately non-existent but I would like to learn more. Does someone have good lisp web pages to recommend?

 

Thank's in advance!

Link to comment
Share on other sites

I don't know the whole lisp (working on trying) but as a quick selection of all solids this line works great.

 

(setq ss (ssget "all" '((0 . "solid"))))

Link to comment
Share on other sites

Now i'm kinda new at this too, but this worked for me :)

 

(defun c:solchg ()
 (setq ss (ssget "all" '((0 . "solid"))))
 (if (/= (sslength ss) nil)
   (command "Chprop" ss "" "c" "253" "")
   (princ "\nNo SOLIDS FOUND!")
 )
(princ)
)

SolidColorCHG.lsp

Link to comment
Share on other sites

Well it seems to select all solids in paper space and in model space. If you have no solids in the space your in then it won't work. hmm...

Link to comment
Share on other sites

Sorry for late response, I've had a lots of work to do despite the financial crisis.. :wink:

 

It works perfect for me! Thank you so much and thanks for the link. Now I will have a lot of spare time enjoying the sunny weather outside. 8)

Link to comment
Share on other sites

I suppose MiGo's code could be re-written more succinctly as:

 

(defun c:solchg (/ ss)
 (if (setq ss (ssget "X" '((0 . "SOLID"))))
   (command "Chprop" ss "" "c" "253" "")
   (princ "\n<!> No SOLIDS FOUND! <!>"))
 (princ))

 

Or in VLA:

 

(defun c:solchg  (/ ss sel)
 (vl-load-com)
 (if (setq ss (ssget "X" '((0 . "SOLID"))))
   (progn
     (vlax-for Obj  (setq sel (vla-get-ActiveSelectionSet
                                (vla-get-ActiveDocument
                                  (vlax-get-acad-object))))
       (vla-put-color Obj 253))
     (vla-delete sel))
   (princ "\n<!> No Solids Found <!>"))
 (princ))

 

Getting carried away now... :P

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