TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: A_LOTA_NOTA on December 05, 2008, 09:33:24 AM
-
In our company standards it is stated that all viewports must be locked before closing a drawing. So a co-worker of mine would like to a program that will unlock all the viewports when the drawing is opened & lock them again when it is closed.
So what is your opinion on the best way to do this?
Thanks for your thought
-
IF all the viewports are unlocked when the drawing is opened - what is the point in locking them in the first place ?
-
Good point Alan.
No one there to see if they are locked. 8-)
-
You may find something you can use from here:
http://www.theswamp.org/index.php?topic=7097.0
-
IF all the viewports are unlocked when the drawing is opened - what is the point in locking them in the first place ?
He doesn't like locked viewports, so he wants his to be unlocked when he opens a drawing. Then to comply with company standards he wants them to be locked when he closes the drawing. A typical lazy drafter, not wanting to press any extra buttons to lock/unlock the vports. :-)
-
And being the VB/A junkie that I am, I/we use this to lock all viewports within the current drawing.
Public Sub LockAllVPorts()
Dim oLayout As AcadLayout
Dim oEnt As AcadEntity
With ThisDrawing
For Each oLayout In .Layouts
If Not oLayout Is .ModelSpace Then
For Each oEnt In oLayout.Block
If TypeOf oEnt Is AcadPViewport Then
oEnt.DisplayLocked = True
End If
Next oEnt
End If
Next oLayout
End With
ThisDrawing.Utility.Prompt vbCrLf & " Viewport locking complete!"
End Sub
-
Good point Alan.
No one there to see if they are locked. 8-)
If the boss opens a drawing they better be locked. So then someone would be there to see if they were locked.
-
IF all the viewports are unlocked when the drawing is opened - what is the point in locking them in the first place ?
He doesn't like locked viewports, so he wants his to be unlocked when he opens a drawing. Then to comply with company standards he wants them to be locked when he closes the drawing. A typical lazy drafter, not wanting to press any extra buttons to lock/unlock the vports. :-)
What's his reason for wanting unlocked viewports? Is it so that he can work within the PS viewport? If so, he can just double-click on the viewport outline and that will throw him INTO the viewport and he can pan and zoom and work, and when he's done, all he has to do is simply double-click the MAXIMIZE/MINIMIZE VIEWPORT icon.
-
IF all the viewports are unlocked when the drawing is opened - what is the point in locking them in the first place ?
He doesn't like locked viewports, so he wants his to be unlocked when he opens a drawing. Then to comply with company standards he wants them to be locked when he closes the drawing. A typical lazy drafter, not wanting to press any extra buttons to lock/unlock the vports. :-)
What's his reason for wanting unlocked viewports? Is it so that he can work within the PS viewport? If so, he can just double-click on the viewport outline and that will throw him INTO the viewport and he can pan and zoom and work, and when he's done, all he has to do is simply double-click the MAXIMIZE/MINIMIZE VIEWPORT icon.
Matt,
I agree, that would be the way to do it (that is how I do it myself). Most drafters have the mind set that "my way is the only way" & it is better to not challenge that sometimes. So when he asked me to write it for him I said I would look in to it.
-
IF all the viewports are unlocked when the drawing is opened - what is the point in locking them in the first place ?
He doesn't like locked viewports, so he wants his to be unlocked when he opens a drawing. Then to comply with company standards he wants them to be locked when he closes the drawing. A typical lazy drafter, not wanting to press any extra buttons to lock/unlock the vports. :-)
What's his reason for wanting unlocked viewports? Is it so that he can work within the PS viewport? If so, he can just double-click on the viewport outline and that will throw him INTO the viewport and he can pan and zoom and work, and when he's done, all he has to do is simply double-click the MAXIMIZE/MINIMIZE VIEWPORT icon.
Matt,
I agree, that would be the way to do it (that is how I do it myself). Most drafters have the mind set that "my way is the only way" & it is better to not challenge that sometimes. So when he asked me to write it for him I said I would look in to it.
Just tell him straight up that AutoCAD already has a command and he should use that instead of you having to reinvent the wheel just for him. And besides... what happens if he unlocks the viewport and, I dunno... FORGETS to lock it again or FORGETS to push the button?? Now you're looking at creating a reactor that fires only when a drawing is saved and disregards any autosaves. I run into stuff like this all the time here. I tell "Yeah, I can look into that." and when I come back to them and say, "instead of doing this, AutoCAD already has THIS feature". Most of the time their response is "Cool! I didn't know that!". So now they're happy, you're happy. Life is good.
-
The first time he screwed a viewport up in a drawing, I would kick his ass.
-
The first time he screwed a viewport up in a drawing, I would kick his ass.
And I'd hold him tightly about the neck while you did. Then I'd look for the guy that gave him the function.
The boss has a reason for locking the viewports. If you give this bozo a method to circumvent the boss' intent, the boss will hold YOU responsible.