Author Topic: Super-Simple Control of Layers  (Read 4354 times)

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Super-Simple Control of Layers
« on: February 25, 2013, 11:14:27 PM »
Gents
I'm a newbie to the forum, but have been using DesignCAD for about 20 years. Rather than simply feed on your contributions (which have been very helpful) I thought I'd try to contribute.  Here goes.
(NB If you're looking for rocket science, you're reading the wrong post lol).

I realise that it is easy to allocate colours based on layers, and vice versa, using layer manipulation.  However, I prefer to do this using my own macros, many written pre V18.

I rigidly use the following colours (think rainbow):-
layer 1 = white ,  RGB = 255,255,255
layer 2 = red,     R00 = 255,000,000
layer 3 = yellow,   RG0 = 255,255,000
layer 4 = (lime) green,  0G0 = 000,255,000
layer 5 = (aqua) blue,  0GB = 000,255,255
layer 6 = (fuchia) purple, R0B = 255,000,255
layer 7 = dark blue    00B = 000,000,255
layer 8 = etc
layer 9 = etc
(I rarely use more than 6 layers)

I use macros "1-9" and "a" (and hotkeys ditto) as follows :-
1.d3m = layer 1, (making it current and the only unlocked layer) – it also sets the current colour to white, and the cursor, point, and all rubber bands also change to white - (hence a white rubber band confirms to me that I am selecting layer 1 only).

2.d3m = layer2 only, red, incl rubber band = R00
etc to
9.d3m = darker purple

I then use
a.d3m = manipulate all layers, which simply unlocks all layers.   It also sets the rubber band(s) to the same soupy brown that I use for selected entities,  Rg0 = 255,130,0

Note that one would run “2” , or “2 and then a”.   (for layer 2 only, or layer 2 and all others resp).

Next there are a set of macros which dump a selection into a given layer, including changing its colour.
selto1.d3m = selection to layer 1, changes colour to white
selto2.d3m = selection to layer 2, red, etc

I also allocate hotkey "s" to stretch, which I use a lot. (love those hotkeys!).

Anyway, I find it makes things pretty efficient, hitting hotkeys (1, a, s, 2, a, etc) that do everything for you, and confirmation that you are only selecting eg layer 2 (/red lines) by the fact that the rubber band itself changed to red;   or that you are collecting a soup of all colours/layers by the fact that the rubber band is brown, etc (2 cents).    A purist would choose white for all colours I guess, but that's already allocated to layer1.   

Finally there is a macro "col2layer.d3m", which interrogates all entities in a selection and puts them in the correct layer according to their colour.   I'm sure there are more efficient ways to do this, using hexadecimal notation maybe, but this is ok for me.   

You can also have a "layer2col.d3m" macro, which is self explanatory.   
[Apologies if others have already posted something similar here anyway].

In summary, I really like DesignCAD.   I attach representative macros which hopefully explain the ghist. Can add more if people are interested, but they are simple logical extensions of these principles.   

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: Super-Simple Control of Layers
« Reply #1 on: February 26, 2013, 08:44:06 AM »
samdavo, 

Thanks for posting.  I always enjoy reading about how folks use DesignCAD, especially if they make it unique to their needs and/or work patterns.  Also a big fan of anyone that gives BasicCAD a shot.  Don't worry about repeating yourself.  Many of us need the repeating.

Your programs remind me of the early days.  I used 15 colors (per AutoCAD defintions) and I loved the DesignCAD DOS  LSE command. LSE stood for layer separate.   I would pick a color (H for hue), and simply draw.  Every once in a while typed LSE and everything ended up on the correct layers.  It was so clean and simple compared to AutoClunk. 

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #2 on: February 26, 2013, 01:13:09 PM »
thanks prl
H is for hue, - floods of nostagia mate. :)

layer separate indeed.
btw I still import long columns of xy coords from lotus 123 (still works with windows 7 thankfully) - to draw, eg a hydraulic cylinder in plan and section - a single macro om 123 to export 5 such files, and then a single macro to import them into designcad.
(assigning colour and layer as you did so).
 
(I mirror bits to minimise the work to make the xy columns obviously).  You are left with 5 components of said object, each correct colour and layer
I used to have a macro "shave",  which saved the 5 layers/components parts as 5 files.  Even more nostagia. 

As for importing xy files - I've never tried importing xyz files (and very rarely use 3D) - preusmably it would make it easier to draw a 3D object?

The other thing I haven't mentioned is that there are many uses for layers once generated (or rather the potential is there for a fertile mind).   eg, (just speculating here) I notice that DT (drolltroll) posted a macro "Flatten" on his toolbox thread.  Hence, just as this sets z=0 for all or part of a drawing, eg one layer, I assume it could be twigged to assign z= 100 or some other value for another layer (?).  Presto, 3D.  :)  That is only speculation on my part - but it hopefully illustrates what I am getting at.  Cheers
« Last Edit: February 28, 2013, 10:29:35 AM by samdavo »

MarkX

  • Hero Member
  • *****
  • Posts: 1223
  • Now where did I put my pencil?
Re: Super-Simple Control of Layers
« Reply #3 on: February 26, 2013, 01:57:25 PM »
DC has a layer-separate tool built in. Haven't tried it recently to know if it works.

Mark

Lar

  • Hero Member
  • *****
  • Posts: 2620
Re: Super-Simple Control of Layers
« Reply #4 on: February 26, 2013, 04:54:58 PM »
... and I loved the DesignCAD DOS  LSE command. LSE stood for layer separate.   I would pick a color (H for hue), and simply draw.  Every once in a while typed LSE and everything ended up on the correct layers.  It was so clean and simple compared to AutoClunk. 

After my first time testing layer separate more than 20 years ago I have avoided it like the plague. Now after all these years Prl gives a reason for using it. It won't be much use to me since I normally would put the same color on many layers... but it's good to know.

Lar

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #5 on: February 26, 2013, 06:11:10 PM »
Lar
yes, assigning layers based on colour can be disastrous if you don't mean to do it.

I start my macro "col2layer" (included above) with a warning that you will lose your layering if you're not concentrating.   "Proceed? Y for yes, anykey for no".   If you proceed, then even "Cntl+Z" won't bring it back.  (think I'm right there).

I believe it is more dangerous that "layer2colour" (enclosed) because "Cntl+Z" seems to undo successfully, i.e. seems to return any changed colours back to orig colour one at a time.  (2 cents).   

PS (late addition) After further checking, I might have to withdraw that claim about successful undo.  But at least the entities remain in correct layer (for 1-7 at least) with lay2col. (1 cent).
« Last Edit: February 26, 2013, 06:30:16 PM by samdavo »

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: Super-Simple Control of Layers
« Reply #6 on: February 27, 2013, 05:13:54 AM »
yes, assigning layers based on colour can be disastrous if you don't mean to do it.

And if I remember correctly, drawing in certain colors was primarily motivated by the pen plotter assignments (.25 mm, .35 mm, .50 mm, and .70 mm).  Always a scary event wondering if the pens would work all the way through a plot ( a 20 minute per sheet process).

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #7 on: February 27, 2013, 11:11:39 PM »
prl, yep they were the days.  Try telling that to kids these days, they wouldn't believe you (as the Python quote goes).

Back to those “primary colours” (and you and Lar have reminded me why I chose them  - i.e. it all started with H for a (primary colour) Hue back in the floppy disk days, and layer separate,   but we move on...)

I enjoyed reading Leroy’s thread from Feb 2010 (with contributions from Magic et al).  Well done.   This finally worked out how to permanently set your colour toobox to these colours.    (I believe he was looking at a CAD/CAM situation - which often only works with primary RGB colours).
http://forum.designcadcommunity.com/index.php?topic=2752.msg14275#msg14275

I enclose a file “RGBplusH.cus” (after you delete the final txt - added to permit posting here - see below)  - that I obtained, originally from DT (drolltroll), and then I worked on it some more.  (Hope no-one is offended, but I think it’s an improvement, albeit a peripheral one).  My aim is to get Primary RGB colours in the Toolbox, and also the option of muddier Hues in the Custom Color Table (CCT).  (PS and the option of toggling between them is discussed below).

Basically, suppose you start with a (single column) colour toolbox that you aren’t fully happy with and/or you find unreliable (see step 1 unpalletable) – note that the full 8row x 8column colour array (when you doubleclick the toolbox) suggests primary colours at the top of each column, but the toolbox is still corrupted – a problem discussed at length in Leroy's thread.  Note how the third row (or sometimes fourth etc - almost "random") is chosen from the array, i.e. to be offered in the colour toolbox - resulting in a different colour purple than the primary one at the top row of that (second) column. - this is typical for all the colours in the toolbox - i.e. they are not (necessarily) "pure RGB" colours.  eg 219 0 255 is not 255 0 255 etc.

Then you unlock the top “Basic Color Table” (BCT), (see step 2)
and you import the enclosed RGBplusH.cus file (step 3).
(Note that you will have to delete the "txt" suffix - adding txt was the only way I could attach it)
PS If you import the cus file without unlocking, then the new BCT colours are ignored, although the CCT ones are loaded.

Finally you lock the BCT again, and you “Save as Default”  (step 4).
Please refer enclosed screendumps  (which omit step 4 – you’ll have to imagine that).

You now have a reliable color toolbox, and also the option of choosing Hues.
And it will be there unchanged next time you open V22.

PS I add three colours for the bottom rung of the color toolbox – rarely used.   I imagine that you could put a set of 8 different "muddy hues" in that column (of the array) if you wish/prefer.  (and that right hand column becomes the bottom row of the colour toolbox - in case you weren't confused enough). PPS that would give you 15 colours in the BCT - and , prl, I believe you siad something about matching AutoCAD's 15 layers (?) - I'll let others modify this colour set as they wish.
QED. (I think)

PS I realise that Magic's idea of rotating the BCT and CCT - after unlocking the BCT - is another way to do this.   Just that the above brings in two completely new tables, for both BCT and CCT (2 cents).      PPS.  But a variation on that idea is that you can rotate them back and forwards, effectively swapping BCT and CCT in the process,  (similar to toggling).  All you have to do is unlock the BCT, and then click the rotate icon situated between the two colour sets.   Then lock again, and save as default. 

PS Not sure if anyone uses the muddy hues - I know I don't.  Anyway, this might help for those who do.  Cheers. and feel free to post any criticisms / improvements etc.   PPS One obvious improvement would be to choose a better set of muddy hues for the CCT set - but I leave that for some other rainy day (since I don't use it).
« Last Edit: March 01, 2013, 02:58:23 PM by samdavo »

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #8 on: February 27, 2013, 11:31:13 PM »
PS   Note that the above discussion of a true RGB toolbox doesn't really affect my own drawing style / philosophy of using macros "1, 2, etc to 7" (or more) to change colour and layer.
plus "selto 1",  "sel to 2", etc
plus "a" (for manipulate all layers).     

I never use the colour toolbox myself.   I find it simply clutters up the screen - and, it is easier to just use those macros. (2 cents).
And that way, you change layer and colour together - "impossible" to get it mixed up.  PS. If I may wax lyrical for a minute, Like an artist working on a canvas, you concentrate on the lines in the drawing (and the rubber bands), not on distractions like drop down menus, and menus within menus, etc.

(yeah right - I hear you say - then why do you need the "col2layer",? lol).  Errors still creep in I guess (especially with old drwgs from the ill-disciplined archives).  PS. If a double negative means a positive, then how come a double positive (yeah right) means a negative?.

PS.  And just as Keat's last line in Ode to a Grecian Urn is ‘Beauty is truth, truth beauty',  I'll make this my last comment in summary.
i.e. my philosophy, Owed to DesignCAD :- 'simplicity is truth, truth simplicity—that is all I know in DCAD, and all I need to know'.  Cheers.
« Last Edit: February 28, 2013, 11:17:19 AM by samdavo »

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #9 on: March 01, 2013, 04:46:16 PM »
PPS that would give you 15 colours in the BCT - and , prl, I believe you siad something about matching AutoCAD's 15 layers (?) - I'll let others modify this colour set as they wish.
QED. (I think)

....
  PPS One obvious improvement would be to choose a better set of muddy hues for the CCT set - but I leave that for some other rainy day (since I don't use it).
Two pieces of unfinished business for that colour toolbox set (both BCT and CCT)
And since it's raining I will post the improvements I suggested above.

I attach RBGplusHb.cus.txt.  (Again, to use it, you have to delete the txt suffix).

1.  The bottom row of the BCT toolbox (= right column of the 8x8 colour set) now has 8 colours to complete the 15 AutoCAD colours  (well 16 if you include both black and white - but Designcad treats them as the same I believe - certainly for display purposes anyway, depending on white or black background):-
 
Number, Colour, RGB
0  - Black - 0,0,0
1  - Blue - 0,0,255
2  - Green - 0,255,0
3  - Cyan - 0,255,255
4  - Red - 255,0,0
5  - Magenta - 255,0,255
6  - Brown - 165,103,82
7  - Light Gray - 170,170,170
8  - Dark Gray - 85,85,85
9  - Bright Blue - 85,85,255
10 - Bright Green - 85,255,85
11 - Bright Cyan - 85,255,255
12 - Bright Red - 255,85,85
13 - Bright Magenta - 255,85,255
14 - Yellow - 255,255,0
15 - White - 255,255,255

The second improvement is that the CCT has been returned to the multicoloured original DCAD default.

Third comment is that the Custom Colour Pallette icon on the colour toolbox becomes the quick way to access the above multicoloured original DCAD default colours -  (while the coloured boxes of the toolbox remain true to  the primary colours - at least the top 7 do,  - whilst the bottom square expands to give 8 different colours).
E&OE
« Last Edit: March 01, 2013, 05:18:26 PM by samdavo »

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #10 on: March 02, 2013, 02:16:29 AM »
PS Herewith a screendump of that colour set - (RGBplusHb screendump).
I agree with Leroy that the first 7 columns of the BCT (to give a reliable RGB primary colour toolbox) should be monocolour (at least for the current V22 - maybe that will be sorted for V23?).   Always assuming you use the colour toolbox - which I repeat I don't.
« Last Edit: March 02, 2013, 02:22:21 AM by samdavo »

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #11 on: March 02, 2013, 03:32:17 PM »
So, in conclusion :)  I'm sure you will appreciate the fact that I will stop posting rainbows after this -

I enclose a screendump of the left hand side of my DesignCAD work-screen where I manipulate layers using those macros (with wide lines drawn for emphasis) - as against the doubtlessly confusing discussion above concerning the colour box.

Like I say in post #1,  If this were rocket science, we never would have made it off the ground, let alone to the moon.
Cheers.   Finis. 
« Last Edit: March 02, 2013, 03:40:55 PM by samdavo »

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #12 on: March 02, 2013, 03:39:02 PM »
... and as a jpeg:-

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #13 on: May 08, 2013, 09:28:29 AM »
Since these posts , I have changed yellow layer 3 to brown ( because yellow doesn't print);
and also added layer 0.  (2 cents)
cheers

I post a zip file of a full set of ten macros, designed to set layer and colour
 
0 = dark grey (almost Aluminium, but not quite)
1 = white , layer 1
2 = red, layer 2
3 = brown, layer 3 (PS prints better than yellow)
4 = lime green, layer 4
5 = aqua / cyan, layer 5
6 = fuchia / magenta, layer 6
7 = dark blue, layer 7
8 = light grey, layer 8 ( used for checking sketches , hidden layers etc)
9 = dark purple, layer 9 (rarely lused, being the same as the selection colour)

also
a = all layers visible and editable.

samdavo

  • Hero Member
  • *****
  • Posts: 2588
  • the trick is knowin...^ > v < - which way's up?
Re: Super-Simple Control of Layers
« Reply #14 on: May 08, 2013, 02:25:53 PM »
doh, no sooner done that slept-and-improved-on
 Herewith the macro to use layer 9.  with yellow to highlight what is selected.
Code: [Select]
'macro 9.d3m sets current layer to 9 (only), current colour to dark purple,
'and that also applies to cursor, point, rubberband, etc
'(which provides immediate reinforcement that only layer 9 is being selected
'note NB  selection ALSO  = dark purple, hence possible confusion - use only in emergencies or macros
'dDOH - THAT's RIDICULOUS
'try this instead, yello2 selection when operating in layer 9
'and possibly any others where dark purple is too dark

'sets colour to purple
sys(300) = 130 'red
sys(301) = 0 'green
sys(302) = 255 'blue

layer(9)=6
layer(9)=14

for j = 0 to 255
layer(j)=2
next j
'only locks 255 layers

'cursor to purple because all but d purple layer 9 are locked
sys(331)=130
sys(332)=0
sys(333)=255

'point to purple
sys(312)=130
sys(313)=0
sys(314)=255

'rubberband to purple
sys(306)=130
sys(307)=0
sys(308)=255

'set selection rubberband to purple
sys(324)=130
sys(325)=0
sys(326)=255

'and ALSO retain selection to ... yellow
sys(315)=255
sys(316)=255
sys(317)=0
As I say in earlier posts, I have 0 to 9 as hotkeys, so changing layers is dead easy.