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.

Groups

Started by prl, October 06, 2007, 06:01:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prl

Let me preface this topic with my understanding, call it a definition, of groups.

groups :=  a stored selection set of entities. If you select any member of the group, the entire selection set is highlighted. One can manipulate the group (move, copied, etc., ) in the same manner as if you had individually selected the various entities.

Behavior of groups in version 15 and prior.

If all the entities of a group are on one layer and you turn that layer off, the entities are all hidden. (obvious)

If the entities of a group are on several different layers, and you turn off some of the layers on which some of the entities reside, only the group entities on visible layers will be visible.  (obvious) AND the group is non-selectable (not so obvious, tricky aspect,  but very useful)



If you've been following Dr Pr's discussion about groups, here is something to keep in mind. Starting with version 16 and forward, groups are layer bound.  With version 15 and before, groups were "layerless".  This can be explained better by example.  You need DC versions 15 and either versions 16,17, or 18 to see the difference.

Do the following:

In version 15.3 -
Step 1: new 2d empty drawing.
Step 2: Make layer 1 active.  Draw two red lines.
Step 3: Make Layer 5 active.  Draw two blue lines.
Step 4: Make Layer 10 active.  Select the two red lines and group them. Select the two blue lines and group them.
Step 5: Make layer 15 active and turn off layer 10.

Notice the following:
You can select either of the two groups.
Only layers 1 and 5 have entities on them (The * next to the layer name)
Layer 10 is empty and off.
DesignCAD didn't care that you were on layer 10 when you made the groups.

In version 17.2 -
Same exact steps as above

Notice the following:
You can no longer select either the red or blue entities (groups).
Layers 1, 5 and 10 have entities on them.
While on layer 10, when you Grouped, DesignCAD did something.

So what is on layer 10????
hint: entity 34

Conclusion.  Groups are layer bound.  For those of us that create groups on the fly with tons of layers turned on/off at any given moment, this is a burden because now you always have to remember which layer you were on when you created the group.  Otherwise you will get entities that appear to be are non-selectable.

My solution: k34.d3m

Dr PR

prl,

I repeated your steps in V18.0, except I used the gc.d3m (group count) and k34.d3m (kill entity 34) macros and Drawing Info to check what was going on.

With red line on layer 1 and blue lines on layer 5, and after moving to layer 10 but before creating groups:
group count = 0
max group ID = 0
entity 34 = 0
Help/Drawing Info reports 4 entities and 16 points.

After grouping the red and blue lines from layer 10:
group count = 2
max group ID = 2
Help/Drawing Info reports 6 entities and 16 points.
Options/Layer shows an asterisk on layers 1, 5 and 10 - so something has been placed on layer 10.
Therefore: Two new entities were created on layer 10 by grouping.

Next I ran k34.d3m:
entity 34 = 2 group entities found and deleted.
Options/Layers no longer shows an asterisk on layer 10.
Help/Drawing Info reports 4 entities and 16 points.
Therefore: The two new entities on layer 10 were type 34.

This pretty clearly shows that versions after V15 associate an entity 34 with each newly formed group, and it falls on whatever layer is active when the group is created, and not on a layer where group parts reside. If the entity 34 layer is locked or not visible you cannot select the group.

****

I repeated all this except I did not delete the type 34 entities.
group count = 2
max group ID = 2
Then I moved to layer 15 and grouped the red and blue line groups together (nested groups).
group count = 3
max group ID = 3
Help/Drawing Info reports 7 entities and 16 points.
Options/Layers shows asterisks on layers 1, 5, 10 and 15.
Therefore: One more entity for the nested group was created and placed on layer 15.

After running k34.d3m:
3 group entities found and deleted.
Therefore: The new entity was type 34.

Options/Layers shows asterisks only on layers 1 and 5.
Help/Drawing Info reports 4 entities and 16 points.
group count = 2
max group ID = 2
All of the lines still were selected as a single group if you gravity snapped to any line.

Note: I repeated this just to be sure - the max group ID DECREMENTED to 2!

I repeated everything up to nested groups on layer 15.
group count = 3
max group ID = 3
Then I moved to layer 20 and duplicated (N) all objects.
Options/Layers shows asterisks on layers 1, 5, 10 and 15. None on layer 20.
Help/Drawing Info reports 14 entities and 32 points.
group count = 6
max group ID = 6
After running k34.d3m:
6 group entities found and deleted.
Help/Drawing Info reports 8 entities and 32 points.
Therefore: duplication (N) just replicates the group entities and their associated type 34 entities, doubling the max group ID.

Finally, I repeated everything up to the duplication.
group count = 3
max group ID = 3
This time I copied and pasted while on layer 20.
Options/Layers shows asterisks on layers 1, 5, 10 and 15. None on layer 20.
Help/Drawing Info reports 14 entities and 32 points.
group count = 6
max group ID = 9
Note the difference - copy and paste incremented the max group ID twice what duplicate did.

After running k34.d3m:
6 group entities found and deleted.
Help/Drawing Info reports 8 entities and 32 points.
group count = 4
max group ID = 8
Therefore: Copy and paste results in greater incrementing of the max group ID than simple duplication. It looks as if the type 34 entities may be counted twice when incrementing the max group ID. I am not certain about this!

***

Continuing from above, I drew two green lines on layer 20 and grouped them.
Options/Layers shows an asterisk on layer 20.
Help/Drawing Info reports 11 entities and 40 points.
group count = 5
max group ID = 10
After running k34.d3m:
1 group entities found and deleted.
group count = 5
max group ID = 10
Help/Drawing Info reports 10 entities and 40 points.

***

Max group ID does decrement sometimes when type 34 entities are deleted, but not always. Apparently it decrements if nested group entity 34s are deleted.

The k34.d3m macro removed the type 34 entities, but does not ungroup groups, even nested groups. However, Group Explode will not explode nested groups after the type 34 entities are deleted. Recursive Group Explode will explode the nested groups, but only to the original individual lines - not to the groups that were nested.

****

I suspect (but am not certain) that the max group ID overflow occurs when the number reaches some mysterious count. The number may continue to increment, but above the threshold the upper bits are ignored when new groups are created, so it looks like the next ID is 1. If there is an existing group 1 when the next group is created, the new group parts are assigned to group 1, associating them with the old group 1 parts. The next ID will look like 2. If there is no existing group 2 the new group is created OK, not scrambled with anything else. This would explain the sometimes apparently random scrambling of new group parts with existing groups.
DesignCAD user since 1987

prl

Dr Pr,

I actually understand your post. Here's something for you to know, especially if you are like me and you reuse parts from other drawings for new work.

Step 1: new 2d empty drawing.
Step 2: Make layer 1 active.  Draw two red lines. Group them and run gc.d3m.  (no big surprise right)
Step 3: Do a symbol load (Ctrl F9) with "Load and Explode" checked.  Import the below sample part.

SamplePart.DCD

Step 4: run gc.d3m  (nice huh).  Doesn't take much of this before you are over the top.

if you are game to have more fun, continue on in the same drawing

Step 5:  in horror - delete this part and run gc.d3m  (looks like we are safe again, right, group count = 1)
Step 6: draw two more lines, and group them.  Run gc.d3m (argh!!!!)

Lar

Guys, if a group can't be selected because parts are on a layer that is off you can open the layer dialogue box and click the "Unlock All" button. The group can now be selected (don't know if this still works in v18). You will see the whole group when the selection turns magenta (or whatever color you have it set to) but if you Regenerate the stuff on the off-layers will disappear (but remain selected). If Point Select Mode is active you can see the points of the invisible entities and a Move or Duplicate command, with ghost preview, will show all the entities of the group.

This effect will work for an undetermined length of time. Not sure what turns it off but you will have to repeat it later in your session.

I reported this trick sometime earlier but can't find my original post.

Lar

Dr PR

Lar

This does work in V18.0.

I'm not sure if I think the unselectable groups are a problem or not. My personal work style has been to confine all parts of a group to a single layer most of the time. This wasn't a conscious decision, but just how I learned to do things. I use groups to associate parts of a single assembly, and I want all of it on a single layer so I can display or hide the whole thing. So not being able to select things on hidden layers hasn't been a problem for me. After all, that is one of the reasons for hiding things, and locking layers.

It became a problem when DesignCAD started scrambling groups by connecting newly formed groups to other groups on hidden layers. The real problem comes if you delete a group with other layers unlocked. What else did you delete? When this problem first appeared for me I had been working on a drawing for months, and then I began to notice bits and pieces were missing, sometimes things that I had designed many weeks in the past. Fortunately, I do original design work in small files and copy (there goes the max group ID) the finished object to the larger file, so nothing was lost except the time to replace the missing pieces.

So, keep all unused layers locked, use gc.d3m to track the max group ID, and run k34.d3m early and often.
DesignCAD user since 1987

Dr PR

prl

I couldn't download the SamplePart.DCD file.

How many groups are in the symbol? How much does the symbol load increment max group ID? Have you tried cutting and pasting the symbol into a file? How much does that increase the max group ID?

I am trying to understand the side effects of different ways of adding parts to a drawing.
DesignCAD user since 1987

prl

#6
Quote from: Dr PR on October 09, 2007, 01:54:58 PM
I am trying to understand the side effects of different ways of adding parts to a drawing.

Exactly what this topic is all about.  In case you wonder how I managed to make such a part, I used DesignCAD's "Save as Symbol" command.  Oh yes, it has one group in it but increments the max group index by 3348.

Hi there Lar!  I miss "yous guys".  Where be cj, tri?????

Lar

Hey prl. Whassup! CJ and Tri may have just passed me downtown Bay St, but if they did I wouldn't have known it was them, unfortunately. Wait, I think Tri showed his mug in a video once. If CJ ain't gat on his blue sailor (crackerjack) suit I'll probably just pass him by (not that I go around looking for sailors to pick up). Knowing him, he probably has a DesignCAD tattoo.

As for the group bug thing, you know I didn't have that problem for a good while until you guys brought it up. I think my computer is spooked.

Lar


Dr PR

prl

Interesting! I opened your "samplepart.dcd" in V18.0 and ran gc.d3m:
group count 1
max group ID 3348!

Then I opened a new file, drew two simple lines, and then  ran File/Load Symbol in V18.0. Then I ran gc.d3m:
group count 0
max group ID 0

I selected the symbol, opened the Info Box, and it calls it a symbol. Help/Drawing Info repores 3 entities, total points 17.

Then I exploded the symbol with the Explode" button in the Info Box.

Drawing Info reports 9 entities and 42 points.
Selecting parts of the ex-symbol reveals a group composed of (at least) a line and a circle.
gc.d3m reports:
group count 1
max group ID 3349
k34.d3m reported 1 group entities found and deleted.
Drawing Info reports 8 entities and 42 points.
gc.d3m reports:
group count 1
max group ID 3349

Then I selected the group and executed Tools/Group Explode.
gc.d3m reports:
group count 0
max group ID 0

This is one of those cases where I don't understand all that I know.

I repeated everything as above except before I exploded the symbol I grouped the two lines.
gc.d3m reports:
group count 1
max group ID 1
k34.d3m reported 1 group entities found and deleted.

Then I exploded the symbol.
gc.d3m reports:
group count 2
max group ID 3349
k34.d3m reported 1 group entities found and deleted.

Next I exploded the ex-symbol group only.
group count 1
max group ID 1
k34.d3m reported 0 group entities found and deleted.

Then I grouped all of the elements of the ex-symbol.
group count 2
max group ID 3350
k34.d3m reported 1 group entities found and deleted.

***

In the Navy we had a signal flag code "Interrogative Whisky Tango Foxtrot" for situations like this.

As a sanity check I closed DesignCAD, restarted it and repeated the procedure. Yes, max group ID did drop to 1 after I exploded the ex-symbol group, and yes, it dod increase to 3350 after I regrouped the ex-symbol elements.

One more time ... I repeated everything up to and including exploding the ex-symbol group.
group count 1
max group ID 1
k34.d3m reported 0 group entities found and deleted.

Then I drew two new lines and grouped them.
group count 2
max group ID 3350
k34.d3m reported 1 group entities found and deleted.

I repeated this except I did not group anything before I ungrouped the ex-symbol group.
group count 0
max group ID 0
Then I created a group from the first two lines.
group count 1
max group ID 3350

****

So, somehow the largest historical max group ID is remembered and used when the next group is created. Apparently nothing will prevent this, even eliminating all groups and starting over at group count 0.

I started over with a new file with two ungrouped lines. Then I loaded the symbo, duplicated it (N) and copied and pasted it (CTRL C, CTRL V).
group count 0
max group ID 0

Then I exploded one and only one of the symbols.
group count 1
max group ID 3352

It knows the other two symbol groups are there but doesn't count them!?

I copied and pasted all fo the ex-symbol parts.
group count 2
max group ID 3356

Then I exploded another symbol.
group count 3
max group ID 3358

Note - I wasn't running k34.d3m, so every copied group increments the max group ID twice. But it didn't increase the count by about 3350 when I exploded the second symbol. Hmm.

Enough! I will have to think this over a while. However, k34.d3m is your friend, and watch that max group ID.
DesignCAD user since 1987

prl

Scivy waver?

Anyway, yes, in summary.

1.  When you save a part and then merge (or cut and paste) from an old drawing or parts library into a new drawing, be careful of the max group id of the new part.

2. When you create parts by saving with "save selection only", or symbol save, DesignCAD is sloppy and doesn't reduce or purge the high group id numbers of the saved part. 

3.  When you empty a drawing, DesignCAD doesn't zero out the max group id variable, Always shut down and reload DesignCAD.

4.  Be careful with template drawings or old "go by" drawings.  They may be stacked with high index numbers to start with.  (Kind of defeats the purpose of CAD, draw it once, use it over and over)

Dr PR

Black shoe, missile geek, nuke spook.
DesignCAD user since 1987

drgroen

Guys,

We're seeing the group problems here, too.  Fairly small drawings with a few groups (50) and group numbers in the 16K region.

I'm thinking of having one of my guys write a program to work on an ASCII verison of the database which would:
1. Read in the file
2. Compile a list of group numbers
3. Re-number the groups starting at a low number
4. Write out the resulting file.

Questions:
a.  Has anyone done anything similar in resetting the group numbers in a DCAD file?
b.  Is there any more definitive file format list other than the Apprneix F DC2 file format?

Thanks
Dave Groen

drgroen

Looking at the Group issue from another angle...

I noticed in DCADAlias.d3i the following line:
   Alias ENT_GROUPINDEX          &H0115  'R/W - i

At first glance, it would seem to indicate that we might be able to use a macro to change the group index of an entity.

Comments?

Dave Groen

prl

Hi Dave,

To answer your questions, yes, I created a delphi exectuable that compacts the group numbers in the manner you describe. However, I created this code at my expense. Since IMSI doesn't feel inclined to do the right thing even when problems are reported release after release, I'm not feeling too generous lately.

Nevertheless, a few tips, never write out to DC2 and read back the data because you will corrupt your drawing. DC2 files are single precision data and *.dcd files are double precision. 

Below is some basiccad wrapper code that will give some clues.  Rather than use ENT_GROUPINDEX, it uses the old fashion getattr and putattr.  Same concept regardless.


'Program groupfix.d3m (repack group index numbers)
'
' June 10, 2005 notes
'    DesignCAD acts weird if the group index numbers are above 16,000.
'    It also doesn't repack numbers as groups are created.
'    This code repacks the group index numbers

'also saved as gfix.d3m
'also saved as gf.d3m

outfile$="c:\grouplist.txt"
open "o", 1, Outfile$

precision 0
print "writing out data entity "
for j = 1 to sys(9)
  getattr j, type, select, laynum, groupid, red, green, blue, solidid
  if groupid > 0 then
    gi$ = groupid
    if len(gi$(i))=1 then gi$(i)="0000"+gi$(i)
    if len(gi$(i))=2 then gi$(i)="000"+gi$(i)
    if len(gi$(i))=3 then gi$(i)="00"+gi$(i)
    if len(gi$(i))=4 then gi$(i)="0"+gi$(i)
    print #1, gi$, j
  endif
next j
close #1

print "running external groupindexfix.exe"
run "groupindexfix", 2 'basiccad will stop until ole program issues continue message

a$="c:\groupout.dat"
fmt$ = "%f,%f"
open "i", 1, a$   

'print "reading in data"
sys(36)=1
precision 0
do while eof(1) = 0
  input #1, b$
  parse b$, fmt$, gid, ent
  print "reading in data for entity ", ent
  getattr ent, type, select, laynum, groupid, red, green, blue, solidid
  putattr ent, type, select, laynum, gid, red, green, blue, solidid
loop

sys(80)=0
'regen

Precision 0
MaxGroup = 0
Window 2, 60
Locate 1, 1
Print "Maximum Group Number: ", MaxGroup

for i = 1 to Sys(9)
  Entity i
  If Sys(94) > MaxGroup Then
    MaxGroup = Sys(94)
    Locate 1, 1
    Print "Maximum Group Number: ", MaxGroup
  endif
next i
sys(36)=0
sys(1)=0

Locate 2, 1
Print "Done.  Recommend saving, exiting and reloading to clear DesignCAD persistent variables."

anykey
wclose

end

drgroen

prl,

Thanks! That's exctly what I needed. I figured that I could get help on the forum.

I was able to modify it to fix things up without doing any external processing.  Now I can have my guys run through all the files for the major project we're working on and fix them up.

Let me know if you want a copy of the revised macro.

I noticed that your macro was dated 2005!  If something similar to the group bug would have been in a piece of software that WE released, it would have been fixed very quickly in a maintenance release.

Thanks again.  I really appreciate all the support that you give to everyone on the forum!

Dave Groen


Dave Groen