Jump to content

Toggle Lineweights when switching between Model and Paperspace?


Recommended Posts

Posted

I have a humble request. Is there a way to enable Lineweights when I go into any Paperspace Layouts, then toggle off when I go back into Modelspace? I'd like something simple that I can add to my acaddoc.lsp file. Is this something that's easily done?

 

I'm willing to pay... a cup of coffee or a six pack of beer? Paypal or otherwise. :)

 

Thanks in advance!! -Tannar

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • tzframpton

    8

  • BlackBox

    7

  • Lee Mac

    6

  • Tharwat

    3

Top Posters In This Topic

Posted Images

Posted

... Gotta run now, but I'll be back to help you out (unless someone beats me to it). :)

Posted

No problem; does I have to be LISP, or is .NET alright?

Posted

Do it however you so choose. As long as it loads and works every time I open AutoCAD, and .NET is perfectly fine with me. :)

 

*EDIT*

The reason behind this request is because I want to set up AutoCAD how Revit works. I want to set my Paperspace to White Background, then use the "Display Plot Styles" option so when the Lineweights toggle is turned ON, it gives me a "plot preview" of sorts. Revit is very efficient with things like this and I want AutoCAD to behave similarly, but the constant LWT toggle is just super annoying.

Posted

2014 brutha! ;)

 

I just installed my home use license last week with my new computer.

Posted

Perfect. When I'm done ill slap together an Autoloader .bundle which makes it essentially drag and drop (even if your session is already open).

 

Cheers

Posted

Awesome! Thanks again. I'll just officially make you my go to guy for this little nugget. Man I'm excited!! :)

Posted

Hi ,

 

Save this piece of code in acaddoc and restart Autocad and let me know :)

 

(vl-load-com)
(vlr-command-reactor nil '(
                         (:vlr-commandended . CommandEnded)
                         )
)
(defun CommandEnded (reactor param)
 (if (eq 1 (getvar 'TILEMODE))
   (setvar 'LWDISPLAY 0)(setvar 'LWDISPLAY 1)
 )
 (princ)
)

Posted

Hi Tannar,

 

Add the following to your acaddoc.lsp:

([color=BLUE]defun[/color] c:lwr-on ( )
   ([color=BLUE]if[/color] ([color=BLUE]=[/color] '[color=BLUE]vlr-miscellaneous-reactor[/color] ([color=BLUE]type[/color] lwreactor:reactor))
       ([color=BLUE]if[/color] ([color=BLUE]vlr-added-p[/color] lwreactor:reactor)
           ([color=BLUE]princ[/color] [color=MAROON]"\nLineweight reactor already running."[/color])
           ([color=BLUE]progn[/color]
               ([color=BLUE]vlr-add[/color] lwreactor:reactor)
               ([color=BLUE]princ[/color] [color=MAROON]"\nLineweight reactor enabled."[/color])
           )
       )
       ([color=BLUE]progn[/color]
           ([color=BLUE]setq[/color] lwreactor:reactor
               ([color=BLUE]vlr-miscellaneous-reactor[/color] [color=MAROON]"lineweight-reactor"[/color]
                  '(
                       ([color=BLUE]:vlr-layoutswitched[/color] . lwreactor:callback)
                   )
               )
           )
           ([color=BLUE]princ[/color] [color=MAROON]"\nLineweight reactor enabled."[/color])
       )
   )    
   ([color=BLUE]princ[/color])
)

([color=BLUE]defun[/color] c:lwr-off ( )
   ([color=BLUE]if[/color] ([color=BLUE]=[/color] '[color=BLUE]vlr-miscellaneous-reactor[/color] ([color=BLUE]type[/color] lwreactor:reactor))
       ([color=BLUE]progn[/color]
           ([color=BLUE]vlr-remove[/color] lwreactor:reactor)
           ([color=BLUE]setq[/color] lwreactor:reactor [color=BLUE]nil[/color])
           ([color=BLUE]princ[/color] [color=MAROON]"\nLineweight reactor disabled."[/color])
       )
       ([color=BLUE]princ[/color] [color=MAROON]"\nLineweight reactor not running."[/color])
   )
   ([color=BLUE]princ[/color])
)

([color=BLUE]defun[/color] lwreactor:callback ( obj arg )
   ([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=MAROON]"MODEL"[/color] ([color=BLUE]strcase[/color] ([color=BLUE]car[/color] arg)))
       ([color=BLUE]setvar[/color] 'lwdisplay 0)
       ([color=BLUE]setvar[/color] 'lwdisplay 1)
   )
   ([color=BLUE]princ[/color])
)

([color=BLUE]vl-load-com[/color])
(c:lwr-on) [color=green];; Enable reactor on load[/color]
([color=BLUE]princ[/color])

The reactor will be enabled by default on loading, but you can also turn it on/off manually using the commands 'LWR-ON' & 'LWR-OFF'

(LWR = LineWeightReactor)

 

@Tharwat: I wouldn't want the reactor to fire after every command!

Posted

@Tharwat: I wouldn't want the reactor to fire after every command!

 

I could not find a way to check if the current layout is equal to Model or any of the other Layout's names , and that's way I went that way . :)

 

But the function you used is very straight to the point :vlr-layoutswitched

 

Thanks

Posted

... Looks like date night with Mrs. BlackBox last night, and some fun in the sun today allowed me to miss out... I'm always happy to not help. :)

 

 

 

Some thoughts on the topic generally....

 

Firstly, it's unfortunate that this is not already part of the page setup configuration, particularly when 'display plot styles' is enabled, which would still be lacking to my mind.

 

While the code posted does exactly what has been requested, it's only able to do so as we're dealing with a drawing saved sysvar, and neglects to either turn off, or restore the original LWDISPLAY value at drawing open when LWR-OFF is invoked.

 

If that is sufficient for some, great... However, if only a portion of any production team uses this, then some members will be opening drawings with this setting enabled (if opened at all by others). This can easily lead to inconsistency within the same project, which may not be a large issue for daily production per-se in the context of LWDISPLAY being a user preference, but is not generally seen as positive when sending inconsistent drawings out to the client(s) & contractor(s).

 

For this reason, I suspect that this potentiality (and I could be mistaken) may make it difficult to use in an actual production environment which must adhere to any form of standards (other than always use this, of course).

 

 

 

That said, I really do not understand why it (or perhaps an aptly named LWDISPLAYAUTO) is not available as a bit-coded sysvar, which allows for lineweights to be displayed in all potential modes:

 

  • 0 - Off
  • 1 - Model
  • 2 - Model, when 'display plot styles' is enabled
  • 4 - Layout(s)
  • 8 - Layout(s), when 'display plot styles' is enabled

 

 

Being that this setting is saved to the drawing OOTB however, and it is unlikely to be changed, I also feel it prudent to offer an optional mode for the changes being made:

 

  • 0 - Off, restore original LWDISPLAY setting prior to save/close
  • 1 - Save changes to LWDISPLAY

 

... This mandates a few implicit tasks, however, such as per-Document data storage, and a small contingent of appropriate event handlers to implement such functionality.

 

I've not yet submitted an app to Exchange that includes a new sysvar, but I may just do so with this (after coding the functionality described here for a pseudo-named LWDISPLAYAUTO app)... I have a project from Gile somewhere, where I believe he created some new sysvars by overriding some registry security, etc. (not sure), but at minimum, it would be easy to store this to registry within the profile as I'm doing for some other apps now.

 

 

 

In any event, I gotta run... Off to grill up some Bloody Mary steak for supper.

 

Cheers :beer:

Posted
If that is sufficient for some, great... However, if only a portion of any production team uses this, then some members will be opening drawings with this setting enabled (if opened at all by others). This can easily lead to inconsistency within the same project, which may not be a large issue for daily production per-se in the context of LWDISPLAY being a user preference, but is not generally seen as positive when sending inconsistent drawings out to the client(s) & contractor(s).

 

For this reason, I suspect that this potentiality (and I could be mistaken) may make it difficult to use in an actual production environment which must adhere to any form of standards (other than always use this, of course).

 

How is this any different to users manually altering the setting of LWDISPLAY? Furthermore, given that we are only talking about lineweight display, your point is equivalent to requesting that all drawings be saved with the same current layer...

 

Frankly, I think you are blowing this way out of proportion with your wording, and generally nitpicking for the sake of one-upmanship.

Posted

How is this any different to users manually altering the setting of LWDISPLAY? Furthermore, given that we are only talking about lineweight display, your point is equivalent to requesting that all drawings be saved with the same current layer...

 

Frankly, I think you are blowing this way out of proportion with your wording, and generally nitpicking for the sake of one-upmanship.

 

What's got your wand in a knot? ... First you 'speak strongly' (yell?) at Tharwat, and now this? :?

 

Take a step back, mate, and see this for what it is, rather than inferring offense that never existed. I've considered you to be a friend, certainly a mentor since I joined the forums, and you've certainly seen me have some bad days, so that's what I am chalking this up to for the time being. :thumbsup:

 

 

 

I was quite sincere, and put a great deal of thought into volunteering my time on this, despite Tannar offering to compensate me for my efforts (here and via email; I hope he doesn't mind my saying so? :unsure:)... I thought it would be a simple (not simplistic) app for portathon, which Autodesk would pay me for, and that would also allow me to offer it as a free app for others (certainly Tannar would get it for free, and well before being potentially published).

 

For the record... I started this LWDISPLAYAUTO project Friday night when I got home from work, before taking out Mrs. BlackBox, and continued working on the app for a bit the following afternoon (+/-275 lines of code in all) before we spent a few hours more getting some sun out by the pool, because I felt (and still feel) that this idea had merit for all the legitimate reasons described above, without which BTW Autodesk would reject my app submission:

 

bbox_LwdisplayAuto01.jpg

 

bbox_LwdisplayAuto02.jpg

 

 

 

As for your analogy, while I share the sentiment that this should be user preference, unfortunately, LWDISPLAY is a drawing (not application) saved system variable, just as PSLTSCALE, VISRETAIN, and UNITMODE are. Admittedly these have greater impact than LWDISPLAY; I'm not suggesting them to be equivalent, simply making the point that they're all stored to Drawing by Autodesk design, and should share some common level of 'handling' when making changes, IMO. It's perfectly fine if you, or others disagree.

 

As it happens, LWDISPLAY is part of two of the client standards to which I must adhere at work (remember, I'm a CAD Tech, not a professional developer; my example was from personal experience on a new project started this year)... And yes, these two standards also mandate the drawing be saved in their respective CELAYER specification... I'm not kidding, there's a 3rd party add-in which tells us what percentage our drawings are in compliance with their standard at save/close, which is ridiculous, IMO. They're the client so we do what we're told, because they run this same check on all submittals, and if not within a percentage tolerance, they reject our submittal (read do not pay us).

 

 

 

To suggest so cavalierly that this not relevant at all (even if only to some), dismiss something which you frequently critique others on (accounting for all possible potentialities), and then for you to be so defensive at the suggestion that you somehow neglected 'something' that you resort to name calling, is disappointing to be diplomatic.

 

I've apologized to you many of times for far less, my friend... Because I respect, and admire you... I would very much appreciate your doing so in turn, as I feel that your intentional miss-characterization is out of line, and petty.

Posted

For the record, I did not resort to 'name calling' at any point, but I apologise if you took offence from my post - this was not my intention, I was merely speaking my mind at the time.

 

You have my apology, however, I stand by my assertion that the 'issue' was being exaggerated far beyond what was necessary.

Posted
What's got your wand in a knot? ... First you 'speak strongly' (yell?) at Tharwat, and now this? :?

 

Honestly I did not get it that way you did BB , I know Lee that he does not have any intention to speak loudly even , but I understand that he is looking for the best performance of coding to the others the same technique that he does all the time .

 

All respect and appreciation to your opinion and supports mate BB . :)

Posted

Gentlemen, finally coming back to this thread. I apologize in advance if I facilitated some tense interaction; that was not my intent.

 

The code is working as expected, and for the um-teenth time: A big thanks Tharwat and Lee!! It is always very appreciated to receive such support from guys like you.

 

:)

Posted
Gentlemen, finally coming back to this thread. I apologize in advance if I facilitated some tense interaction; that was not my intent. The code is working as expected, and for the um-teenth time: A big thanks Tharwat and Lee!! It is always very appreciated to receive such support from guys like you.

 

You're most welcome Tannar, given your valuable contributions to this forum and indeed other forums (you still at the Swamp?), I am always willing to lend a hand. I'm sorry that the thread was sidetracked in this instance.

 

Honestly I did not get it that way you did BB , I know Lee that he does not have any intention to speak loudly even , but I understand that he is looking for the best performance of coding to the others the same technique that he does all the time .

 

Thank you Tharwat, please know that I hold no ill-feelings towards you - I was simply informing you that the reactor needn't be triggered for every command issued.

Posted
(you still at the Swamp?)
Not at the Swamp anymore. Was tired of being ridiculed and belittled constantly so I left there. I've always felt more at home on this forum so this is my main stomping grounds for AutoCAD stuff. I spend more time on Revit forums nowadays due to shifts in market demand.

 

:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...