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.

Frozen Bitmap image

Started by Hughaircraft1, January 22, 2015, 03:56:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prl

#30
Quote from: samdavo on January 27, 2015, 05:03:56 AM
PS I add the same jpeg I posted earlier which shows where you should look for the "edit" flag.

Pretty messed up and dangerous.   You hide a layer and it is editable and the icons show the wrong thing.  A disaster waiting for someone.

State 4 is meaningless.  Can't do any damage.
State 5 is very dangerous.  The potential for damage is high.


Edit:  But if you use basiccad and the Layer Statement, example  Layer(2)=0, to make the layer invisible (which is what I do), then the layer function will report it properly as a state 1 with the icons coordinated (meaning invisible and not editable as it should be).
.
Thankfully I don't use the various dialogs. 

prl

#31
Sam, tried your drawing on different DC versions.  Behavior seems be changing after version 18.

With version 18 and before, do this.

Open your drawing.

1. Make layer 15 the current drawing layer.  Draw a magenta line.

2. Using the toolbar layer dialog pulldown, turn the lightbulb ON for layer two.  Red line appears.

3.  Select the magenta line and the red line and group them.

4. Now again using the toolbar layer pulldown, turn the lightbulb OFF for layer two.  Red line is hidden and layer pulldown reports lightbulb is OFF AND layer is locked.  The lightbulb clicked to OFF automatically triggers the locked layer.  As it should.

5. Use the layer function to find the state. It will report layer 2 as being in state 1 for versions 18 and before.   As it should.

In versions 18 and before, you can see the magenta line but you can't select it.  Typically if you had one of these multilayer creations and one of your layers was invisible for a part of the multilayer creation, the visible part of that collection was unselectable.  That was your clue that you had a collection of grouped entities with some of them being on OFF layers.

But in version 22, you can select the magenta line and if you copy it, you will see you are copying the invisible red line from layer 2 also because layer 2 is not locked even though the icon says it is.  The ghost move/copy will show it but not the final placement move/copy. Here is a movie of the steps I'm doing in version 22.  https://dl.dropboxusercontent.com/u/81411430/DesignCAD/moving%20items%20on%20hidden%20unlocked%20layer.swf

So it can get very hairy when you select a group or solid with items on invisible layers if the invisible layers are unlocked.   When you copy or move, you will find yourself also selecting invisible things when you click on visible things.  Maybe what you want or maybe not.  I just don't see it as being a good thing, selecting invisible things.

Phil needs it because DC often creates new solids that are scattered about different layers even though he didn't ask for that.  So he relies on the UnlockALL button to gather up all the bits and pieces and puts them back on a single layer, or something along those lines.

samdavo

#32
Quote from: prl on January 27, 2015, 05:26:58 AM

Edit:  But if you use basiccad and the Layer Statement, example  Layer(2)=0, to make the layer invisible (which is what I do), then the layer function will report it properly as a state 1 with the icons coordinated (meaning invisible and not editable as it should be).
.
Thankfully I don't use the various dialogs.

ok -
this is (finally) getting meaningful lol.  (and probably illustrating yet more holes in my knowledge bank).

You set it to state 0?  (Statement 0) ? - and it reports state 1 ?

Is that the same as when you allocate state 6/ Statement 6 in the macro,   it reports state 7 ?  and those layers are unlocked.

Or are Layer statements completely different to Layer states ?

Sorry, I once used to understand Layer Statements, but not well enough obviously. (and I'd love to find a good book on programming macros).

PS I look forward to trying the other experiments you suggest when I return from work.

Meanwhile, I was thinking that King Arthur might have been interested in that layer 4 procedure,  i.e. where you turn off the light and the padlock locks (or APPEARS to lock)  -  He didn't have much use for CAD,  but maybe he could have used a light sensitive chastity belt ?  Just a thought from the outer windmills of my mind whilst getting entangled here with lights and layers and padlocks and pencils and  ...  :).

PS What exactly does Layer(2) = 0 mean?

prl

#33
Sam,

BasicCAD has the unfortunate situation where we have a Layer Statement for setting layer states, and a Layer function for reading them.  In other words, where you put the layer(x) relative to the assignment key (=)  makes one a statement and the other a function.   I know, weird.

BasicCAD syntax example summary:

layer(2) = 0   "this the layer statement saying take layer two and make it invisible and lock it

y = layer(2)   "this is the layer function returning the bit value for layer two in variable y, which you are exploring with Phil

QuoteLayer Statement

PURPOSE:   To turn drawing layers on or off, and to set the current layer.
SYNTAX:   LAYER(expression1) = expression2

EXPLANATION:   The LAYER statement can be used to set a layer to be visible/invisible or editable/uneditable. It can also be used to set the current layer. The following values can be used with the LAYER statement:

0 – Invisible and not editable
      2 – Visible but not editable
      6 – Visible and editable

14 – Set as current layer (the current layer is always visible and editable)

"Expression1" is (or evaluates to) the layer number, and "expression2" must evaluate to one of the above values. The LAYER function can be used to get the current status of a layer. See the macro language system function descriptions in the next chapter.
   The REGEN statement or the DesignCAD >Regenerate command should be used to regenerate the drawing if the visibility of layers has been changed. Otherwise, entities from invisible layers may remain on the screen, while entities from visible layers may not appear on the screen.

If you have used PUTATTR to change the layer of an item, you must use the LAYER statement to reset the current layer in order for the layer info in the coordinate bar to display correctly. You can use:

Layer(Sys(3)) = 14    

' This updates the layer information in the
' drawing.

Note: Don't confuse the Layer statement, which is used to set the status of a layer, with the Layer function, which returns the current status of a layer. The Layer function may return other values than those allowed by the Layer statement. Even immediately after setting the layer's status with the Layer statement, the Layer function may return a different value, depending on whether or not that layer contains any entities in it, or other factors.

QuoteLayer function

LAYER(x)    - Layer status of layer x. Returns 0-15
   [legal values: 0, 1, 2, 3, 6, 7, 14, 15]
     Assume y=LAYER(x)

if ODD(y)=0,   -> no entities in layer x. [y = 0, 2, 6, or 14]
   if ODD(y)=1,   -> entities are in layer x. [y = 1, 3, 7, or 15]
   if ODD(y\2)=0,    -> layer x is invisible. [y = 0 or 1]
   if ODD(y\2)=1,    -> layer x is visible. [y = 2, 3, 6, 7, 14, or 15]
   if ODD(y\4)=0,    -> layer x is not editable. [y = 0, 1, 2, or 3]
   if ODD(y\4)=1,    -> layer x is editable. [y = 6, 7, 14, or 15]

if ODD(y\8)=1,    -> x is the current layer. [y = 14 or 15]

All the bit stuff you are discussing with Phil is using the layer function.  You'll note states 4, 5, 8 to 13 are supposed to be programmatically blocked because they don't make sense.


Dr PR

#34
One thing to remember is that most of the code enforces DesignCAD's "editable" definition - visible and unlocked. The only exception that is normally allowed is visible and locked. Otherwise it automatically locks a layer when it is invisible.

DT thought this was strictly enforced, but fortunately the code for "Unlock All" is missing the "editable" enforcement code, and allows unlocking hidden layers. Otherwise the solid Boolean functions would be almost useless. They would create solids than can't be selected or edited.

So you get varying results depending upon what functions are used.

Phil
DesignCAD user since 1987

samdavo

#35
prl
So, although none of this is crystal clear, I think I understand
although for some reason there is a mismatch by one between statement and eventual state (?) , i.e. it seems that

eventual state = statement +1  (??)    (edit) - I believe you say below that that's because it will choose eventual state as odd or even, eg 7 or 6, 15 or 14,  depending on whether it is occupied or not.

Sorry to keep picking your brain, but where do I find what these mean :-
layer(1)=6
layer(1)=14

(I suspect it means
editable, visible;
and also current

in the same way that 6+1 =  7 = editable, visible (and occupied);
and 14+1 = 15 = current (and occupied).

... but it is   is it really necessary to use both,  when just the second instruction, viz
layer(1)=14
would presumably achieve everything?

cheers
sam

PS Phil and prl
I know you blokes are way ahead of me here - particularly with regard to advanced "effects / problems" which follow when you make groups and solids and boolean operations etc ...

But believe it or not, lol, I am trying to keep it simple.  :)
PS This is clearly selfish on my part, since I need to learn how to crawl first. 

samdavo

#36
PS As for those "second tier effects", from my point of view, I am coming around to the view that it is probably wise to ensure that any Group is formed from entities of the same layer and colour (2 cents)

(and I think I have heard Phil say something similar about solids before and after Boolean operations)

prl

#37
Quote from: samdavo on January 28, 2015, 01:10:28 AM
Sorry to keep picking your brain, but where do I find what these mean :-
layer(1)=6
layer(1)=14

Referring to the definitions in reply 33,  let's say your current layer is 23.   It is always visible, editable and has the pencil next to it showing it is the current layer.

Let's also say layer 1 is off.   You then run a basiccad program with:

Layer(1)=6  'this statement will make layer 1 visible and editable  (light bulb ON  and Unlocked Icon).  The current layer is still 23 (the pencil is on 23).  Now you create something with code, say a solid cube.  It is on layer 23 with whatever the current settings are.

but if you issued

Layer(1)=14 ' this statement will make layer 1 visible, editable and make it the current layer.  (light bulb ON, unlocked icon and Pencil.)  Now you create something again with code, say a sphere.  It is on layer 1 with whatever the current settings are for layer one (remember you could also be creating items using by-layer settings for colors, line types, etc.).

edit:  Sam, the reason the layer function may return a different number from the layer statement is because the layer may or may not have entities on them.   The layer statement doesn't need to know if something has entities on it or not.

Dr PR

Sam,

I have always thought it was a bad idea to spread objects across multiple layers.

For solids, it is just silly - a big mistake. Solids are supposed to represent real world objects, and as such are single things, just as a line or circle is. As single objects it makes not sense to have them on multiple layers. You would never try to create a circle on multiple layers (the program won't let you do it, even if you tried).

However, you can create solids on multiple layers - just perform a solid Boolean operation (Add, Subtract) with solids on different layers. DesignCAD allows you to do this, but I think this is a mistake. However, I have seen some people use this to show/hide one side of a solid by enabling/disabling display of the layer the side is on (this is, after all, what layers were created for).

Groups are different. If nested groups worked correctly it would make sense to build up assemblies as groups or groups of groups, with different groups on different layers. For example, you could have a car sugar bowl that was organized as the bowl, the lid and the sugar, each on different layers. All three would be individual objects/groups on different layers, collected together into a nested group. By turning layers on/off you could view the whole assembly or any combination of the parts. But when you moved it all the parts would move together.

Phil
DesignCAD user since 1987

samdavo

#39
Thanks gents.

As usual I have been on a learning curve here, and my replies / posts have evolved from the embrionic to the slightly more correct.

In conclusion, all I can do is recommend you look at the dcd file I posted on reply #27.  It contains layers with "states" 0 to 7, 14 and 15 ...  and all of these are formed by simply using the layer dialogue box, and clicking lightbulbs and padlocks ...

... (sometimes I clicked a lightbulb on layer n - WITH AN OPEN LOCK BESIDE IT - which locked that padlock (i.e. the lock simultaneously closes in sympathy) - and then clicked some other layer, and then clicked layer n again -  and the "editable" box ends up with a tick - although the "visible" box is unticked ...
and that's how you get state 4 or 5).  (Incidentally I don't think you can impose state 4 or 5 with a macro EVEN IF you thought it was beneficial, i.e. EVEN IF you wanted to)

... For those layers, when you unclick the lightbulb,  the padlock unlocks again.

CONCLUSION
In the end I agree with prl,  If you use macros instead of the layer dialogue box , you have a better chance of knowing what is going on ...

ALTHOUGH,
I would challenge some of Phil's claims that ticks in the "editable" box are necessarily "bugs" - (as long as "editable / padlockable" is different/subordinate to "SELECTABLE")  ...  and I can understand that a lot of work has probably gone into the design of the layer dialogue box (which I also never use) - and I have been forced to try to understand the dialogue box (a first) - and I can understand that it is preferred by some experienced users around here. 
(2 cents)

PS Perhaps the challenge now is to post the "perfect" set of said macros? :)

prl

#40
Sam,

IMSI has in an odd fashion seen the need to sometimes have state 5 available but I would have done it much differently.

I would have put a general option flag under Options "Allow for selecting of grouped and composite entities across hidden layers?".

When this option is checked ON, when the user selects something visible that also has hidden items on OFF layers,  a dialog would pop up and simply say.

Warning!  Your selection has attached to it various items on hidden layers.  Continue with selection including hidden
items?   Yes/No.


If you had the optioned NOT checked, DesignCAD would behave like it did in versions 18 and before.  You can't select a composite group/solid with items on hidden layers.

Dr PR

prl,

I agree that the option would be nice. It would free us from having to open the Layers dialog and click on "Unlock All" when we need to gather all the parts of scattered groups or solids. But we would still need to enable the option.

Maybe all that would be needed is the warning message with the option to continue with hidden objects selected. This would be extremely useful when a solid has been scattered over multiple layers by the solid Boolean functions without the user knowing it. We could then immediately open the Info Box and move all the parts to the layer they should be on.

Ditto for when we receive drawings from someone else who has scattered parts of a group over multiple layers and we would prefer them to all be on one layer. Or when we have accidentally created multi-layer groups ourselves.

****

Just for reference I checked some earlier versions (V15.3 is the oldest I still have running). I suspect this behavior has existed from the first versions of the programs with layers and groups.

I opened V15.3 and followed the steps I described above in reply #13. You can select the group with parts on hidden layers after clicking "Unlock All."

The big difference between V15 and some later versions is that when you drag the group the outlines of all objects - hidden and visible - are shown to let you know what/where you are dragging. This is much better than the later versions where the hidden parts are not displayed while dragging.

V17.2 works just like V15.3.

****

I think the earlier versions were much "Friendlier" when they displayed the drag outlines of the hidden objects that were being moved. Because we could see everything that was being moved we could avoid placing the hidden objects in the same location as other visible objects. With current versions it is an unpredictable hit or miss process.

Phil
DesignCAD user since 1987

samdavo

Quote from: prl on January 29, 2015, 04:05:41 AM
Warning!  Your selection has attached to it various items on hidden layers.  Continue with selection including hidden  items?   Yes/No.

A feature request maybe?

or better still a macro (so that we can use it on V22 etc).

Warning!  Your selection has attached to it various items on hidden layers.  Continue with selection including hidden  items?  Press "Esc" to cancel, or Anykey to continue.

I'm reminded of Homer Simpson - searching the keyboard and having to ask for help to find the Anykey :)

samdavo

Quote from: samdavo on January 29, 2015, 12:07:54 PM
Quote from: prl on January 29, 2015, 04:05:41 AM
Warning!  Your selection has attached to it various items on hidden layers.  Continue with selection including hidden  items?   Yes/No.
or better still a macro (so that we can use it on V22 etc).

Warning!  Your selection has attached to it various items on hidden layers.  Continue with selection including hidden  items?  Press "Esc" to cancel, or Anykey to continue.

There are one potential problem yes? 
cevo = 5 = 0101,  editable but invisible. 
(because cevo = 4 = 0100 has nothing there to cause problems)

Comment from the peanut gallery :-
It would be dead simple to write a macro that checked all layers to see if they were state 5, and warned you accordingly.  (It would just be a line or two added to the message in the above macro cevo.d3m).

However I am guessing that won't help when there are groups and multilayered solids (?) And the emphasis should be on the selection, rather than cycling through layers.   (2 cents)

Sorry, I'm just stating the obvious - but maybe you blokes are up to this challenge?

prl

#44
Another approach is to return the program to the way it was in version 18 and before.  When you clicked something and it refused to select, you knew you had a mixed layer composite with items on locked and/or invisible layers. 

The new feature is to introduce a Super Select key and mouse click combination (say something like Shift Esc left mouse click) which will unlock all layers for that single selection click and lets you complete your selection of the item you are clicking at.  And of course, the Warning message about hidden and/or locked layer items would still come up though.

(Basically that is what Phil is doing now though he has to navigate to the layer dialog and hit the UnlockALL button to do it).


edit:  I'm attaching a sample drawing which has a multilayer solid which is unselectable because a portion of it is on a hidden layer and a part of it is on a visible but locked layer. And also a group (the blue closed line) which is unselectable because it is grouped with a red circle on a visible but locked layer.  And a xyz reference triad on layer 15 which is unselectable because it is visible but on a locked layer.

An example for this type of "on demand" special one-time super selection is in the code I wrote:  fsel.d3m

http://forum.designcad.com/index.php?topic=4754.msg29955#msg29955


The fsel.d3m routine emulates what I refer to as the Super Select mode.  Run the fsel and then select one of the previously unselectable items in that sample drawing. Try the blue cube first.  You'll see what I'm referring to as Super Select Mode. It will select the items for that assembly that are invisible and the items that are visible but locked.  Once you have the selection, do a drag copy or move etc.

Mind you, it isn't going to pop up that warning I mentioned since back then when I wrote that code I assumed if you were using fsel.d3m, you knew you had items on invisible and/or locked layers.

Here is a movie that demos the fsel.d3m with the sample dcd file I attached.

A movie - Super Select Demo using fsl.d3m macro