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.

Solution to "Group Entity" AND Grid-Entities layer problems

Started by Lar, January 04, 2009, 11:25:42 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Lar

***EDIT, 27 Jan 11: I suggest changing the following line:
     Include "*\dcadalias.d3i"
by replacing the asterisk with the actual file path where the file dcadalias.d3i is stored, eg: Include "C:\Macros\dcadalias.d3i"
or Windows Vista and 7 may not find the file.
   You can also eliminate or revise whatever messages make the macro tedious for you to use. ***


***EDIT, 7 Jan 09: The macro below has been revised to deal with grid-line-entities and the name has been changed to "Change Entity Layer.d3m" (was "Change Group Layer.d3m"). The macro contains some history documenting why it was updated)***

Hi,

Here is a macro that solves the group "bugger" (as opposed to "bug", since it was intentional) where a "group entity" (entity type 34, I think) is created on the current layer when a group is defined, which may be on a different layer from the actual entities and the group can't be selected when that layer is off or locked.

To use the macro select the group then run the macro (or vice versa). When asked for the layer number just type in the desired number, which would typically be the layer the group is known to be on. Everything selected, included the "group entity" will now be on the entered layer so the you won't have problems selecting again. Just be careful because the layer change can't be undone, since it uses the "Change" command. The macro can be used for any selection, not just Groups.

The strength of this macro is that it can access the "group entity" and change it's layer along with the rest  of the group. BasicCAD is the only way I know that the user can access this elusive "group entity". If you select the group and use the Info Box the layer of the "group entity" does not change. I should say that this macro was written using v17.2. If 18 (or 19?) has a solution for this please let me know.

'*****Macro Start*****
'Change Entity Layer.d3m by Lar,
'Nassau, Bahamas
'created: 4 Jan 2009 (modified from "Copy All parameters.d3m, created  6 Jan 2006).. ..
'.. ..for dcad forum to solve Group Define problem where a "group entity" is created.. ..
'.. ..on the current when a group is defined, which could be different from the layer.. ..
'.. ..the entities are on. If the group entity layer is off (or locked) when the group is later being selected.. ..
'.. ..then the group can't be selected (another trick: open layer dialogue and click "Unlock All" button first.

'Edit History:
'Tue, 6 Jan 2009: After response from prl on forum about getselect not accessing grid-line-entities.. ..
'.. ..I added routine to check for grid-header-entities and if present then access the number of entities following.. ..
'.. ..the header corresponding to the number of 'points' [sys(99)] of the header, which is actually the number of.. ..
'.. ..grid-line-entities that the grid-entity contains. I had used something similar in my Mesh.bsc macrothat .. ..
'.. ..I wrote sometime before Jan 2000 that reshapes grip points to existing lines.

'Wed, 7 Jan 2009: Added message at end advising user to close and reopen Info Box to display the correct layer.


Include "*\dcadalias.d3i"     'you may have to replace the  asterisk with the exact file path, eg: Include "C:\Macros\dcadalias.d3i"

'if nothing is selected yet....
if sys(80)=0 then
sys(1027)=0  'message box style = OK (default)
message "Click-select on an entity with color to check..."
>PointSelect
{
}
end if

NumSel=sys(80)   'number of entities selected...

dim ent(NumSel)

rep:
input "Enter the desired layer number or click Cancel to abort..." elayer
if sys(999) then end

if elayer<0 or elayer>1000 then
message "Layer number must be integer 0 - 1000 please re-enter number or click Cancel to abort..."
goto rep
end if


for ee=1 to NumSel
getselect ee, ent(ee)
next ee


for eee=1 to NumSel
Entity ent(eee)
Change Ent_Layer, elayer
Update

'''goto pass 'use for testing

if sys(90)=32 then 'if a grid-header-entity then must deal with grid lines...
gpts=sys(99) 'get number of grid points, which is the number of grid lines following the grid header
for glt=1 to gpts
entity ent(eee)+glt  '= the grid lines entity number, which always follow the grid header, here for test messages below

'''message "entity type =",sys(90), ent(eee), ent(eee)+glt, "layer=", sys(93)  'use for testing, with low point grids!!

eeee=ent(eee)
GETATTR eeee+glt, type, select, laynum, group, red, green, blue, solid
laynum=elayer
select=1
PUTATTR eeee+glt, type, select, laynum, group, red, green, blue, solid

'''message "entity type =",sys(90), ent(eee), ent(eee)+glt, "layer=", sys(93)  'use for testing, with low point grids !!

next 'glt
end if 'sys(90)=32 'if a grid-header.....

'''pass:   'use for testing

next eee

message "Done!  -  If the Info Box is open the old layer of the selection will be displayer. CLOSE then reOPEN the Info Box to display the correct layer..."

'*****Macro End*****


Lar

Lar

Hi, again...

The macro above has been revised... See the original post...

Lar

bdeck