Author Topic: How to handle multiple layers when drawing a line on each ?  (Read 705 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Newt
  • Posts: 99
How to handle multiple layers when drawing a line on each ?
« on: February 05, 2019, 12:54:36 PM »
One of our groups has hundreds of layers. For years our users have been simple drawing a line and forgetting to put it on the correct layer.

My approach to resolve this was originally, before there were 100s of layers, provide a suite of buttons to start the line command while putting it on the correct layer with all the correct properties for that line set.

simplified code below

Code - Auto/Visual Lisp: [Select]
  1. (command "._layer" "make" "CLOUD" "Color" "RED" "CLOUD" "")
  2. (command "-linetype" "_s" a "")
  3. (command "line")

As you can imagine with 100s of layers there could be hundreds of buttons.

My first thought was a dialog box that prompts the user for the correct layer. Maybe they can specify line, LWpolyline, circle arc, etc..

I'm just looking for a solution that would eliminate a multitude of buttons.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

ribarm

  • Water Moccasin
  • Posts: 2163
  • Marko Ribar, architect
Re: How to handle multiple layers when drawing a line on each ?
« Reply #1 on: February 05, 2019, 01:21:54 PM »
IMHO, the best is to teach users to use line (and other) command(s) properly with some sense of what they are doing at the moment of working... You can never guess what layer and line type users may want to use in advance to make such lisp automatically switch to them in correct adequate moment in process of drawing...
That's just me, but you can preset in advance some set you prefer using the most and I'd suggest lisp that can be called through button and yes you may use dcl or something similar to avoid typing... Just wondering - all commands with button for each one?
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

jlogan02

  • Newt
  • Posts: 99
Re: How to handle multiple layers when drawing a line on each ?
« Reply #2 on: February 05, 2019, 02:08:49 PM »
IMHO, the best is to teach users to use line (and other) command(s) properly with some sense of what they are doing at the moment of working... You can never guess what layer and line type users may want to use in advance to make such lisp automatically switch to them in correct adequate moment in process of drawing...

As it stands right now we have a suite of buttons that sets the desired layer, linetype, color based on what button the user chooses. So if they want to draw a line on layer "X" with a linetype of "Y", they can. That was when there were only a handful of layers. Now they have hundreds. I do agree with you that training might be the best method available.

[/quote]
all commands with button for each one?
[/quote]

See above, this just results in a shite ton of buttons. I think I could minimize the number of buttons needed by reviewing if each layer would be simply for blocks with the possibility that no lines will be drawn on that layer. Problem is, then you're not taking into account the future need for a line on that same layer. You're back to training.



J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

ronjonp

  • Needs a day job
  • Posts: 7044
Re: How to handle multiple layers when drawing a line on each ?
« Reply #3 on: February 05, 2019, 03:20:57 PM »
How is one to know what layer any line should be put on? Sounds like a rabbit hole. What kind of drawings do you do that require hundreds of layers?

You could use something as simple as this to set the current layer from a picked item before drawing.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:ls (/ e)
  2.   (if (setq e (car (entsel "\nSelect entity to set current layer: ")))
  3.     (setvar 'clayer (cdr (assoc 8 (entget e))))
  4.   )
  5.   (princ)
  6. )
« Last Edit: February 05, 2019, 03:34:09 PM by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1003
  • Marco
Re: How to handle multiple layers when drawing a line on each ?
« Reply #4 on: February 06, 2019, 08:10:20 AM »
I have a complex layer (group) program, with few icons I can manage dozens of layers, for example in cruise ships field:
Code: [Select]
Group name
 "COM_" ;Common
 "LAY_" ;LAY-out
 "LAY_TOP_" ;LAY-out TOP/wall
 "LAY_WLL_" ;LAY-out WaLL
 "LAY_CEI_" ;LAY-out CEIling
 "FDT_" ;FounDaTions
 "PRC_" ;PReCoordinations
 "LNG_" ;LiNinG
 "CLN_" ;CeiLiNg
 "FRE_" ;FREon scheme
 "ELE_" ;ELEctric scheme
...
changing layer group automatically can change the icons of the layers related to it for each group each layer can have its own name linetype color, with the activation of a group of layers (topic) and I can establish the visibility of the others layers and if it is necessary change the color and/or line type.
The commands Hatch, Point, Dimxxx, Text, Ray, Xline, Leader, Attdefs will activate the Layer assigned to these entities in the current group...
Line, Pline, Circle, Arc, etc. have a special floating layer "Draw" in the current groupů
To draw something in a non-normalized layer you need manually deactivate the automation so all the designers automatically draw on the same layers and with the same settings.
« Last Edit: February 06, 2019, 08:15:06 AM by Marc'Antonio Alessi »

dgorsman

  • Water Moccasin
  • Posts: 2399
Re: How to handle multiple layers when drawing a line on each ?
« Reply #5 on: February 06, 2019, 12:49:56 PM »
Try not to work directly with layer names - work with what the layers represent. That way the user can think about what they are doing. Your program should do the translation for them.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

jlogan02

  • Newt
  • Posts: 99
Re: How to handle multiple layers when drawing a line on each ?
« Reply #6 on: February 06, 2019, 04:29:32 PM »
How is one to know what layer any line should be put on? Sounds like a rabbit hole. What kind of drawings do you do that require hundreds of layers?

The layer name should reflect the object being drawn. That's how I've always done it. If, I'm drawing a power line or voltage line, there would be a layer for both power and voltage. That way a user doesn't have to be all that concerned with layer name. They now the layer by knowing what they're drawing.

You could use something as simple as this to set the current layer from a picked item before drawing.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:ls (/ e)
  2.   (if (setq e (car (entsel "\nSelect entity to set current layer: ")))
  3.     (setvar 'clayer (cdr (assoc 8 (entget e))))
  4.   )
  5.   (princ)
  6. )

This could work, since we have standard drawings all drawings are started from. Simple selection of the desired object and draw the line.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Newt
  • Posts: 99
Re: How to handle multiple layers when drawing a line on each ?
« Reply #7 on: February 06, 2019, 04:33:36 PM »
Try not to work directly with layer names - work with what the layers represent. That way the user can think about what they are doing. Your program should do the translation for them.

This is something I've always attempted to do. The button name matches the object name matches the layer name.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Newt
  • Posts: 99
Re: How to handle multiple layers when drawing a line on each ?
« Reply #8 on: February 06, 2019, 04:35:06 PM »
I have a complex layer (group) program, with few icons I can manage dozens of layers, for example in cruise ships field:
Code: [Select]
Group name
 "COM_" ;Common
 "LAY_" ;LAY-out
 "LAY_TOP_" ;LAY-out TOP/wall
 "LAY_WLL_" ;LAY-out WaLL
 "LAY_CEI_" ;LAY-out CEIling
 "FDT_" ;FounDaTions
 "PRC_" ;PReCoordinations
 "LNG_" ;LiNinG
 "CLN_" ;CeiLiNg
 "FRE_" ;FREon scheme
 "ELE_" ;ELEctric scheme
...
changing layer group automatically can change the icons of the layers related to it for each group each layer can have its own name linetype color, with the activation of a group of layers (topic) and I can establish the visibility of the others layers and if it is necessary change the color and/or line type.
The commands Hatch, Point, Dimxxx, Text, Ray, Xline, Leader, Attdefs will activate the Layer assigned to these entities in the current group...
Line, Pline, Circle, Arc, etc. have a special floating layer "Draw" in the current groupů
To draw something in a non-normalized layer you need manually deactivate the automation so all the designers automatically draw on the same layers and with the same settings.

I'm going to have to take a closer look at this. I have had something like this pass through my mind a time or two. Just didn't stick.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

ronjonp

  • Needs a day job
  • Posts: 7044
Re: How to handle multiple layers when drawing a line on each ?
« Reply #9 on: February 07, 2019, 09:27:31 AM »
You might also take a look at this: https://goo.gl/xH5hzG

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

BIGAL

  • Bull Frog
  • Posts: 346
  • 30 + years of using Autocad
Re: How to handle multiple layers when drawing a line on each ?
« Reply #10 on: February 12, 2019, 12:02:52 AM »
Learn something new everyday thats a nice command.

This is an oldy pick an object and it sets layer and starts correct command to draw a new object
A man who never made a mistake never made anything