Author Topic: Construction Lines Revisited  (Read 149 times)

Gymbo

  • Jr. Member
  • **
  • Posts: 68
Construction Lines Revisited
« on: April 04, 2018, 02:48:35 PM »
Expanding on Dr PRs suggestion here http://forum.designcadcommunity.com/index.php?topic=7083.0

This is my ultimate goal, pick a layer for my construction lines, set the line type to 1, scale the line scale based on the size of the drawing view (if possible, or size if not), draw the CL then return to working layer and working line type and scale.

This is what I don't understand, using setlayerprops and updatelayer, I've come close, but there are a couple of things I need explained. First after running the macro the line style toolbar is greyed out until I invoke the Layer Options window. Next when first run, the line scale is the default line scale for the layer, the next time it's run it has the proper line scale.

I haven't even addressed modifying the line scale yet. This is what I have:

Code: [Select]
'toggle layer 7 (new construction line) on or off
x = sys(161) 'width of drawing
'message x, sys(5)
sys(1009) = 1 'make Constr line visible
CL = sys(3)  'current layer
LT = sys(4) 'current line type
LS = sys(5)  'current line style
layer(7) = 14
sys(530) = 1
sys(531) = 128
sys(532) = 128
sys(533) = 255
sys(534) = 1
sys(535) = 1
sys(536) = .5 'line scale
sys(537) = 0
sys(538) = 0
sys(541) = 1
sys(542) = 1
setlayerprops 7
updatelayer 7
'message sys(5)
>ConstructionLine
{
<layer 7
<type 0 'line not ray
}
sys(3) = CL 'set back to current layer
layer(7) = 6 'set layer(7) to editable
sys(4) = LT 'reset line type
sys(5) = LS 'reset line scale
sys(26) = 0 'set Edit Current Layer Only to off
>regenerate
{
}

I'm on V23, 2D
Regards,

Jim

bdeck

  • Hero Member
  • *****
  • Posts: 868
Re: Construction Lines Revisited
« Reply #1 on: April 05, 2018, 09:19:01 AM »
I made some changes to your code that seem to have fixed the problem you described. But I'm not sure which ones worked and which ones didn't, or why. Maybe Lar has a clue.

I noticed that the color of the default layer was changed after running your macro twice. That cleared up with this change as well.


Code: [Select]
'toggle layer 7 (new construction line) on or off
x = sys(161) 'width of drawing
'message x, sys(5)
sys(1009) = 1 'make Constr line visible
CL = sys(3)  'current layer
LT = sys(4) 'current line type
LS = sys(5)  'current line style
layer(7) = 2 ' *****************

sys(531) = 128
sys(532) = 128
sys(533) = 255

sys(535) = 1
sys(536) = .5 'line scale
sys(537) = 0

sys(541) = 1
sys(542) = 1
sys(530) = 1 ' ***************** moved
sys(534) = 1 ' ***************** moved
sys(538) = 0 ' ***************** moved
setlayerprops 7
updatelayer 7
'message sys(5)
layer(7) = 6 'set layer(7) to editable      ' *****************
>ConstructionLine
{
<layer 7
<type 0 'line not ray
}
updatelayer 7 ' *****************
sys(3) = CL 'set back to current layer
layer(7) = 6   'set layer(7) to   editable
sys(4) = LT 'reset line type
sys(5) = LS 'reset line scale
sys(26) = 0 'set Edit Current Layer Only to off
>regenerate
{
}

Gymbo

  • Jr. Member
  • **
  • Posts: 68
Re: Construction Lines Revisited
« Reply #2 on: April 05, 2018, 10:40:10 AM »
BD, thanks for your replies. The changes you made to my code did fix the issue with the scale not being applied until the nex time the macro is run. However the greyed out Style Toolbar is still greyed out until I run the Layer Options command.

Your first reply is missing(?), but not before I was able to try it, it seems to work without the toolbar problem, I'll have to study it to see exactly what it is doing. The second set of codes is interesting, more studying.

Is sys(161) the width of the drawing or window and what are the units?
Regards,

Jim

Gymbo

  • Jr. Member
  • **
  • Posts: 68
Re: Construction Lines Revisited
« Reply #3 on: April 05, 2018, 01:04:56 PM »
Combined my macro with your second, works great, now to figure out how to change the scale factor!

Code: [Select]
'toggle layer 7 (new construction line) on or off
x = sys(161) 'width of drawing
'message x, sys(5)
sys(1009) = 1 'make Constr line visible
CL = sys(3)  'current layer
LT = sys(4) 'current line type
LS = sys(5)  'current line style
sl = 0.3   
>ConstructionLine
{
   <Color 128,128,255
  <Layer 7
  <LineStyle 1,[sl],0
  <Type 0
 }
 sys(3) = cl
 layer(7) = 6
 sys(4) = lt
 sys(5) = ls
 sys(26) = 0
End

Thanks again BD!
« Last Edit: April 05, 2018, 02:03:06 PM by Gymbo »
Regards,

Jim

bdeck

  • Hero Member
  • *****
  • Posts: 868
Re: Construction Lines Revisited
« Reply #4 on: April 05, 2018, 03:16:11 PM »
Combined my macro with your second, works great, now to figure out how to change the scale factor!

To change linestyle scale for the entire layer, your sys(536) factor should work.

To change linestyle scale for one entity, look up "Query and Change" parameters. Dont forget the update statement after the change. 

I took down my first post, because it didn't really address your question about layers. But It uses the Change statement and an alias established in the first line to change Linestyle scale.

If you want to change scale of the drawing, thats another item.
bd
« Last Edit: April 06, 2018, 08:53:30 AM by bdeck »

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4216
Re: Construction Lines Revisited
« Reply #5 on: April 05, 2018, 04:10:21 PM »
If the LineStyle toolbox is grayed out, you most likely have 'Automatically Toggle By-Layer Settings' checked in the Layers dialog. When this happens, if you switch to a layer with a preset line style (or color), the linestyle toolbox (or color toolbox) will automatically gray out when you switch to that layer. Either click the last button in the toolbox (layer or color) to toggle the By-Layer setting and get access to the toolbox (or click it again to gray the tools out once more).
25 years with DesignCAD

Gymbo

  • Jr. Member
  • **
  • Posts: 68
Re: Construction Lines Revisited
« Reply #6 on: April 05, 2018, 04:51:07 PM »
I took down my first post, because it didn't really address your question about layers. But It uses the Change command and an alias established in the first line to change Linestyle scale.

Glad I saw it before it was gone. :)
If you want to change scale of the drawing, thats another item.
bd

I've figured out how to handle the scaling, using the sys(120) and sys(122) functions, now to remember how to create the equation. :-\

If the LineStyle toolbox is grayed out, you most likely have 'Automatically Toggle By-Layer Settings' checked in the Layers dialog. When this happens, if you switch to a layer with a preset line style (or color), the linestyle toolbox (or color toolbox) will automatically gray out when you switch to that layer. Either click the last button in the toolbox (layer or color) to toggle the By-Layer setting and get access to the toolbox (or click it again to gray the tools out once more).
Thanks DrollTroll for the reply, looks like I found a work around, something to keep in mind though.
Regards,

Jim

Gymbo

  • Jr. Member
  • **
  • Posts: 68
Re: Construction Lines Revisited
« Reply #7 on: April 06, 2018, 01:42:05 PM »
Anyone interested I've placed the macro in the "Users Contributions" section, it does everything I wanted, (not real elegant math), but it does the job of scaling the construction line. Works reasonably well up to about 100 feet, which I'll never do anything that big.

Thanks to bdeck for his help.
Regards,

Jim