News:

Please note new Forum URL: forum.designcad.com

Main Menu

Info Box "Name" field value

Started by RDBarthel, August 06, 2021, 02:42:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RDBarthel

Running DesignCAD 3D Max 2020, Version 29.0.

Developing a macro to track entity attributes.  Where do I get the value entered in the "Name" field on the Info Box?  I've found layer, material, volume, etc, through SYS$(n), GETATTR, and QUERY commands.  Can't find that Name.

Rob S

This can be accessed using the Sys$(300) Function

The following macro selects lines by entity name



' Finds entities by name and select them
'but you must add a name first.
'=======================================
Input "Name?",name$
Sys(80) = 0
For i = sys(9) to 1 Step -1
  Entity i
  GetAttr i, type
If type = 1 Then              'type 1 is a line 
  if Sys$(300) = name$ Then
    PutAttr i, type, 1
  End If
End If
Next i
Regen
End


The following crude edit to an existing macro prompts for selection, and displays the entities number and name



' This simple macro lets users select an item, then displays the
' Name for that item.
'
' Prompt user to select an item
SetPOint "Please click on an object . . .", 1
' Get that XY Location where user elicked
pointval jx jy jz 1
' Select whatever's at that point
>PointSelect
{
<Type 0
<pointxyz [jx, jy, jz]
}
' Get the Selected Item's ID and Name
getselect 1, a
        entity a
' Display that Name to the user
a$ = Sys$(300)
       
Message "The Name of Entity No.", a ,"  = ",a$
end
User since forever

RDBarthel

Well thank you so much, Rob S., you've relieved me of a lot of frustration.