News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

How to select specific object(s)?

Started by MarkX, March 12, 2012, 10:39:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarkX

Is there anyway to select just one object?

Using ENTITY, I'm able to capture all the points relating to an object. But I can't use the points associated with that object to later select it, because some of those points may be shared by adjoining objects.

Looked through the reference, and surprisingly there doesn't seem to be a way to just select one object by entity number.

Not sure how to add objects to current selection either.

And finally, would like to select objects by name. This is possible inside of DC via the Selection Dialog, but is there a way to do it via a macro command?

Thanks!
Mark

dcadRob

This selects entity N. I don't think you can select by name unless you cycle through all the entities.

'rem select entity number 'N'
include "*\dcadalias.d3i"

>Deselect
{
}

entity N
change ent_selected, 1
update

paulerens

this might be?
' 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
  if Sys$(300) = name$ Then
    PutAttr i, type, 1
   
  End If
Next i
Regen
End 



MarkX


dcadRob

Paul,
You need to GETATTR i,type before you PUTATTR i,type,1

dcadRob

Also, name is case sensitive, which is a nuisance.

paulerens

#6
dcadRob,
Entity is sufficient and it works.

Paul.

MarkX

Quote from: paulerens on March 12, 2012, 01:49:15 PM
this might be?
' 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
  if Sys$(300) = name$ Then
    PutAttr i, type, 1
   
  End If
Next i
Regen
End 

I notice that "type" isn't specified. I suppose that means that type=0. Does zero as the "type" parameter imply that "type" is not to be set?

Thanks!
Mark


paulerens

Effectively, that works better Rob.
Do this Mark.
' 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 Sys$(300) = name$ Then
    PutAttr i, type, 1
   
  End If
Next i
Regen
End

paulerens

Mark,
If type is not specified, it applies to all types (line, plane, curve, etz.)

paulerens

#10
Mark,
With this adjustment, the name will only be found if the entity is a line.
type 1 is a line.

' 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

See, Macro Language statements <GetAttr and PutAttr>

dcadRob

QuoteMark,
If type is not specified, it applies to all types (line, plane, curve, etz.)
'Type' is just a variable. If it had some left over value from a previous section of the program, you could have accidentally changed your entities to that type. That's why I suggested using GETATTR. I never tried using type=0. I don't recall it being stated in the doc that it's a valid value.