VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VB for MVIEW related to layers

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
351 Views, 2 Replies

VB for MVIEW related to layers

I have no experience with VB in Autocad but have used it quite often in other word based applications and know the abilities it has. I was wondering if it could be applied in Autocad as a Macro based function to key on MVIEW of certain things.

 

Background: Viewport 1 is assigned to "Viewport 1" Layer (the frame of it) I am currently applying the layer in which the viewport frame appears. I MVIEW = ON for that viewport frame and the viewport appears. This works vice versa as well. In general this is similar throughout the whole file. What I am wondering is if you could use a Macro that would function in a way that "Viewport" Layer is turned on that frame which is assigned to it appears. EIther by the turning on of the layer or by the frame appearing could this trigger MVIEW = ON and for the turning off of layer or frame disappearing MVIEW = OFF. 

2 REPLIES 2
Message 2 of 3
fxcastil
in reply to: Anonymous

You can also turn off a viewport by right-click on the viewport and selecting the properties of the viewport.

There is a "ON" property under the "Misc" group of properties.

 

VBA has access to the properties of a PViewport.

You want VBA to change the "display" property of a Paper Space Viewport

I fixed the sample code below in the attachment

 

 

 

http://forums.autodesk.com/t5/Visual-Basic-Customization/Viewports/m-p/306668/highlight/true#M9762

Message 3 of 3
Anonymous
in reply to: Anonymous

Here is an example of something similar to what I am doing. Essentially if you look there are two viewport frames one assigned to each layer "Viewport 1" and "Viewport 2". I can toggle the frame of each on and off by applying or turning off the layer. I can also turn the objects off and on by using MVIEW>ON> then selecting the object or vice versa MVIEW>OFF>  then selecting the object. This can be done for each viewport. My goal is to develop some sort of macro that when I turn the layer on say for "Viewport 1" the layer frame appears and MVIEW>ON for this viewport and the other way as well when I turn a layer off and the viewport frame disappears the objects within it MVIEW>OFF for that viewport. Essentially this will apply for all the viewports withn my file so it would fit perfectly.

 

I have never used VB in autocad I am assuming where you would put the code would be under the Manage Tab and under the Visual Basic Editor correct?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost