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.

Macro to turn on/off layers

Started by MarkX, January 08, 2013, 07:40:38 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

prl

#15
Quote from: dcadRob on January 12, 2013, 06:26:18 AM
I recall that there was a discussion about some of these weird states (ie not visible but editable).

To correct my previous comments, the only layer state we can't set is the invisible and editable, the 4th state Phil mentions above.  For me it is much easier to understand Phil's discovery if you simply ignore the terminology Locked and Unlocked.

0 – Invisible and not editable
2 – Visible but not editable
4 - Invisible and editable  (Doesn't exist - I just put it here)
6 – Visible and editable
14 – Set as current layer (the current layer is always visible and editable)


Edit:  Thanks dcadRob.  And Phil, in the above where I say "doesn't exist", that refers to BasicCAD only.  You have indeed demonstrated the state exists.

dcadRob

You should edit your post and change the 1 to a 4. That is the correct value.

Seems there ought to be better ways of fixing Dr PR's problem.

Dr PR

dcadRob,

I can see no faults with the way the visible and locked layer controls work. It is perfectly logical. I cannot understand how anyone could possibly think it is a bug!

The only problem I see is that the lock icon doesn't actually tell you if an invisible layer is unlocked/editable (bug).

However, if it was up to me the lock icon in the Layers Dialog would function independently of the visibility icon, so you could unlock a single invisible layer without having to change all invisible layers.

****

There are two reasons why it is necessary to be able to set the invisible and unlocked/editable state:

1. To allow you to select groups that exist on multiple layers where one of the layers is invisible/locked.

For this to work properly, the parts on the invisible layers should be ghosted when the group is selected so the user can see the effects of moving the group. Fortunately, V22.1 does this correctly while the group is moving. It would be nice if it happened immediately when the group is selected.

You might say this is unnecessary because a user should know which layers parts of groups are on and make them visible before trying to select the group.  I think anyone with significan intelligence can give several reasons why that argument is nonsense.

Unfortunately, DesignCAD offers no way to determine which layers parts of groups are on - the Info Box just says "multiple" in the layer box. So it becomes an "Easter egg hunt" to find the invisible parts, switching layers on/off until all the invisible pieces are found.

It is so much easier to just unlock all layers and go on about your business.

2. To allow you to select grid objects that have been scattered all over the place by the solid Boolean functions.

The solution to this problem is to fix the solid Boolean bug that moves parts of grids to other layers and changes the materials and colors.

Phil
DesignCAD user since 1987

paulerens

Hi Phil,
I feel invisible and unlock not always as a bug.

Take five layers in a group and make one  invisible, then the group is not movable.

Open the Layers Dialog and click "Unlock All." Then this group is movable.

Paul.

dcadRob

Why not just make an object selectable even when parts of it are on locked layers?

dcadRob

QuoteUnfortunately, DesignCAD offers no way to determine which layers parts of groups are on - the Info Box just says "multiple" in the layer box. So it becomes an "Easter egg hunt" to find the invisible parts, switching layers on/off until all the invisible pieces are
Should be fairly easy to figure it out using a macro.
Quote
2. To allow you to select grid objects that have been scattered all over the place by the solid Boolean functions.
This also sounds like it can be cleaned up with a macro.

Dr PR

dcadRob,

Making objects selectable when parts are on locked layers would solve the problem.

I guess this could be an option.

Another way would be to make a double click (left click) or gravity snap (right click) select objects with parts on locked layers. Click/snap once, and if the object is not selected, click/snap again at the same place. We would need to think about this for a while, because it may have unwanted ramifications.

Phil
DesignCAD user since 1987

JJG

Quote from: dcadRob on January 12, 2013, 06:00:32 PM
Why not just make an object selectable even when parts of it are on locked layers?
that exits already in Designcad, v19 and the french versions pro 7000 and 8000,
ie. when "group-visibility by host layer" is enabled.

But, unfortunately, some have obtained that it has been removed since v20 ... (for the US versions)

prl

Quote from: Dr PR on January 12, 2013, 10:55:37 PM
Making objects selectable when parts are on locked layers would solve the problem.    I guess this could be an option.

Phil, Paul

See if this macro does what you need.  Should work for those scattered-to-the-wind solids too.

Only warning - if you decide to zoom in our out while the program is asking you to select the group or solid, you will be forcing a regen, which may be what you are trying to avoid in a busy drawing.  So simply pick the item, nothing more.

'Program Fsel.d3m (force selection of groups and solids across non-visible layers)

dim lstate(1000)

nlayers = 1000 'set this to the typical layer range you use

'record current layer states
for i = 1 to 1000
    y = layer(i)
    if ODD(y\2)=0 then lstate(i) = 0                  'layer is not visible
    if ODD(y\2)=1 and ODD(y\4)=0 then lstate(i) =  2  'visible and not editable      
    if ODD(y\2)=1 and ODD(y\4)=1 then lstate(i) =  6  'visible and editable      
    if ODD(y\8)=1 then lstate(i) =  14                'current layer
next i

'WITHOUT a regen, make visible all layers
sys(36)=2
for i = 1 to nlayers
   Layer(i) = 6
next i
sys(36)=0

'Have user make selection
>pointselect
{
<CmdPrompt "Set a point on the group or solid"
}

sys(36)=2
'put back layer states as recorded
for i = 1 to nlayers
   layer(i) = lstate(i)
next i
sys(36) = 0

End

paulerens

prl,
Impressive!
I have a macro based on the same idea but without first  examining the state of the layers .
I'm impressed!

Paul.