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 see entity ID?

Started by MarkX, October 15, 2011, 10:42:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarkX

Is there a way to see the entity ID from within DesignCad? I don't see anything like it in the information panel, but maybe somewhere else?

Thanks!
Mark

Bob P

Do you have the macro documentation?

Getselect:
PURPOSE:   To get the entity number of one of the currently selected entities.
SYNTAX:   GETSELECT expression, variable
EXPLANATION:   This statement can be used to retrieve entity numbers of selected items so these items can be investigated with the ENTITY statement, if desired. Information about the entities can also be retrieved with GETATTR and changed with PUTATTR. "Expression" is a number, variable, or mathematical expression evaluating to an integer which determines which of the selected entities you want the entity number for; "variable" is the name of the variable you want to store the entity number in.

GETSELECT will ignore any selection status changes made by the PUTATTR statement. Entities must have been selected by the DesignCAD Select command, either earlier in the macro or before you ran the macro.

See Also: ENTITY, GETATTR, PUTATTR

COMPATIBILITY:   Version 9 (DesignCAD 97) and later

EXAMPLE:   

' This example assumes you have already selected

' several items before running the macro

Dim ent(10)   'Create an array for ten entity numbers

' Make sure no more than ten items get processed

maxsel= Sys(80)

If maxsel > 10 Then maxsel = 10

Window 10, 40

For j = 1 To maxsel

  Getselect j, ent(j) 'get info for selected items

  Print "Picked item ",j, " is entity ", ent(j)

Next j   'go to the next item
Anykey

MarkX

Thanks Bob,

My problem is that I'm trying to debug a script and want to find the identity number *without* a macro script. After moving a planar polygon, either the id number is changed, or the data points for the polygon are corrupted. I thought maybe there was a way to observe the identity number outside of a script. That would help me narrow down the problem.

Thanks!
Mark

Lar

#3
An entity's id only changes if an entity with a lower number is deleted (the id of the entity in question will drop relatively) and *maybe* if it is involved in a reordering operation ('move to front', '...back', etc).

A lower entity can be deleted without you knowing (if you don't know how dcad operates). For example: if you slice a solid some of the original entities that make up the solid may be deleted and replaced (such as an original grid-surface may be replaced by plane-surfaces). If you delete then undo the 'un-deleted' entity are actually new entities with id numbers at the end of the id list. Same sort of thing happens if you trim lines and circles.

The only way to determine an entity's id outside of a macro (and this is only practical if a few entities exist and only works with no grid-surfaces present in the drawing) is to select everything, open the info box, click the 'cycle entities' button and scroll through the list of entities until the one in question highlights green (on the screen). The info box will show the number of the entities in the selection set and this should correspond to the entity's id, as long as no grid surfaces are in the drawing, unless it's the very last entity (the grid header and each line in the grid entity {those parallel to the original line the grid was created from, not the ones running perpendicular} have id numbers).

Lar
**edit** Nested groups also count as entities... see my next post below...

MarkX

#4
Thanks Lar,

I have one (apparently) gridded object in the drawing, which makes the count entirely different. The Info count sees only 7 objects, but the object id in the macro is 24.

I've posted the problem I'm having in the SDK/BasicCad forum section.

Edit:
Posting for problem is HERE

Thanks!
Mark

Lar

#5
If you select a grid the info box will tell you how many lines it has. So, if the grid's id is lower than the entity in question ("EIQ") you can add the number of grid lines to the EIQ's number in the info box.

Another thing that just came to mind: if you use nested groups then each occurrence of a nested group has an entity id (and I'm not talking about the actual entities that make up the nested groups). Strange, but true.

There's no practical or error free way to determine an entity's id other than through a macro.

Maybe DT can put this somewhere near the top of his to-do list for the next version of dcad.

Lar
ps:
Quote
I've posted the problem I'm having in the SDK/BasicCad forum section.
It's best to generate a link to another topic since it will become increasingly more difficult to find as time goes by.

MarkX

Quote from: Lar on October 17, 2011, 06:31:38 AM

Quote
I've posted the problem I'm having in the SDK/BasicCad forum section.
It's best to generate a link to another topic since it will become increasingly more difficult to find as time goes by.
Thanks Lar,

Well, things seem pretty sleepy over there. Like it might take years to scroll to the bottom. But I've fixed up my first post to include the link, and will repeat here.

Posting for problem mentioned above is at this message.

I have just one cylinder solid in the drawing that I think is creating most of the points. But I have to explode it twice (once as a solid, then as a grid) to be able to get the entity count right -- plus counting it once as grid and once as a solid. So, yeah, the math for such a simiple goal is pretty mysterious. I could delete the cylinder, but I wanted it for later.

Thanks!
Mark