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.

GetAttr problem with Groups?

Started by SilentType, July 08, 2008, 07:23:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SilentType

Hi All,

Using V17.2 I have an annoying anomaly. That I'm hoping someone else has a solution to.

Using following code I am analysis a series of selected entities. When selecting groups, it find each of the entities plus the group entity (Type 34).

The problem I have is that in some files it will decide that the group entity is in fact a line (type 1) which result in a disastrous response when I probe it for further information - often resulting in a crash of design cad.

Try this - draw one line, and a piece of text. Then group them together. Run the following code and if it works correctly you'll get Types 1, 3 & 34.

But when opening pre-existing files I can get a variety of outcome. I've attached a couple of examples.
GroupEntity.dcd gives 1,3 & 34.
NoGroup.dcd just gives 1 & 3.
WeirdGroups.dcd - this one is just strange. If I select the grouped entities separately I get a different result than if I select it all.

I'm assuming that there is some connection with what version the file was originally created in. Is there anyway to ask the file what it thinks it is eg V17, V13?

I've notice that in some cases when selecting the groups the count starts at 1, other time at a value that probably relates to what number it was assigned when created.

Can anybody point me in the right direction?


'-----GET USER TO SELECT THE LINES
>DRAGSELECT
{
<TYPE 0
<incomplete
}

'-----RECORD NUMBER OF ENTITIES SELECTED
NumSelected = SYS(80)

WINDOW 10,50
'-----FOR EACH LINE SELECTED
FOR cnt = 1 TO NumSelected

GETSELECT cnt, CurrLine
ENTITY(CurrLine)
GETATTR cnt, EntityType,select, laynum, group
Print cnt, " Type, ", EntityType, " Group, ", Group
NEXT

anykey


'-----MAKE NOTHING SELECTED
SYS(80) = 0

END

prl

#1
St,

Entity 34 was introduced as of version 16.  Groups in the last three versions of DesignCAD have more problems than version 15 and before. Lots of posts about this on this forum.



Regarding your code, try changing your code at the GettAttr line.  Remove entity statement and fix is in blue.

-----GET USER TO SELECT THE LINES
   >DRAGSELECT
   {
      <TYPE 0
      <incomplete
   }

'-----RECORD NUMBER OF ENTITIES SELECTED
   NumSelected = SYS(80)

   WINDOW 10,50
'-----FOR EACH LINE SELECTED
   FOR cnt = 1 TO NumSelected

      GETSELECT cnt, CurrLine
      ENTITY(CurrLine)
      GETATTR CurrLine, EntityType,select, laynum, group
Print cnt, " Type, ", EntityType, " Group, ", Group
   NEXT
   
   anykey
   

'-----MAKE NOTHING SELECTED
   SYS(80) = 0
   
END

SilentType

Thanks PRL, that seems to solve what I need.

It still seems to not report the groups in some files, but as my current macro doesn't need it either way, it's not troubling me.

ST