Jump to content

Recommended Posts

Posted

Hey guys,

 

Just trying to create a SSGET filter list which will filter specific materials, wondering if someone could please let me know the material DXF group code?

 

Command: li LIST
Select objects: 1 found

Select objects:
                 3DSOLID   Layer: "0"
                           Space: Model space
                  Color: 4 (cyan)    Linetype: "BYLAYER"
                   [color="red"][b]Material: Cadet Blue[/b][/color]
                  Handle = 29e1
        History = None
   Show History = No
  Bounding Box: Lower Bound X = -50790.5000, Y = -6154.9113, Z = 10134.6755
                Upper Bound X = -50351.4023, Y = -4450.8109, Z = 10948.6650

 

I could not understand the explanation I found in the Autodesk DXF Reference guide... and AfraLISP does not list materials on their page.

 

Thanks a lot for any help.

Posted

When you do the following make a 3d solid (entget (entlast)) you get massive amount of info but not "cadet blue" in plain english, dumping gets the material, you may have to do it this way and use the if = VL-get material that will mean over select 3dsolids.

 

Select object: ; IAcad3DSolid: AutoCAD 3dSolid Interface

; Property values:

; Application (RO) = #

; Centroid (RO) = (397.433 239.252 10.0)

; Document (RO) = #

; EntityTransparency = "ByLayer"

; Handle (RO) = "11B26"

; HasExtensionDictionary (RO) = 0

; History = -1

; Hyperlinks (RO) = #

; Layer = "DEFAULT"

; Linetype = "ByLayer"

; LinetypeScale = 1.0

; Lineweight = -1

; Material = "Concrete.Cast-In-Place.Flat.Grey.1"

; MomentOfInertia (RO) = (1.01057e+010 2.7707e+010 3.77663e+010)

; ObjectID (RO) = 11865

; ObjectID32 (RO) = 11865

; ObjectName (RO) = "AcDb3dSolid"

; OwnerID (RO) = 11866

; OwnerID32 (RO) = 11866

Posted

Hi BigAl,

 

Thanks for the reply.

 

What do you mean when you say "dumping gets the material"?

 

How did you read/display the data you have shown in your post?

Posted

Use this lisp pick an object.

 

;;; Dump all methods and properties for selected objects              ;
;;;===================================================================; 
;;; DumpIt                                                            ; 
;;;-------------------------------------------------------------------; 
;;;===================================================================; 
(defun C:DumpIt ( / ent) 
 (while (setq ent (entsel)) 
   (vlax-Dump-Object 
     (vlax-Ename->Vla-Object (car ent)) 
   ) 
 ) 
 (princ) 
)

For You try this you can loop through your 3dsolid list and test each one

(setq obj (vlax-Ename->Vla-Object (car (entsel)))) ; pick 3dsolid
(vlax-get-property obj 'Material)

Posted

Oh, awesome. That will come in very handy, thanks BigAl.

 

Regarding the code you provided, I had to insert '(setq obj (vlax-ename->vla-object obj))' (I simply copied this from another routine I have), is this correct?

 

Here is my code below, just a test code, but it does open the door for a few things I have planned.

 

(defun c:RMAT  ( / obj oMAT )

(setq obj (car (entsel))) ; pick 3dsolid
(setq obj (vlax-ename->vla-object obj))
(setq oMAT (vlax-get-property obj 'Material))
(alert (strcat "Object Material = " oMAT))

)

 

Thanks for your help.

Posted

Also... (I had forgotten the original reason I created this thread)...

 

How would you recommend I filter a selection set based on the 'material' name?

Posted

You dont just loop through the 3dsolids selection and check if they match materials answer. Either make a new selection set or just use.

 

(if (= omat "Cadet "blue")

(alert "Found a solid with Cadet blue")

(alert "did not have Cadet blue material")

)

[code/]

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