Access Model Space From A Layout Viewport Autocad For Mac
Hi,So, I've been trying write a program to go into a layout, select the viewport and they edit the viewport's various properties.I have tried searching various combinations of viewports, vba, properties, edit and editing in the forum search and I have not been able to find a relavent thread.My biggest difficulty is accessing the viewport itself. I can't seem to get the sytax correct.Esentially, I'd like something that looks like:Dim lyt As Object 'layoutDim vp As Object 'viewportFor Each lyt In acaddoc.LayoutsIf lyt.Name 'Model' Then'grab the layout as 'vp', I tried something like: lyt.Viewport'vp.SomeProperty = WhatIWant'insert some other stuffEnd IfNext lyt. You appear to be accessing Autocad from the outside. If so, you may have to modify the 'Thisdrawing' designation.Sub PVPortManipulation'Iterate through the viewports of every paperspace Layout.' Change the pviewports height to 6'Change it to SE Iso view'Move each paperspace vport 2 units to the right.' Thanks for the quick response SEANT!1.
Viewports are areas that display different views of your model. As you work on the Model layout, you can split the drawing area into one or more adjacent rectangular views known as model space viewports.In large or complex drawings, displaying different views reduces the time needed to zoom or pan in a single view.
A) The code looks quite helpful. However, if I create a new layout it would only have the primary layout and no other, correct? So if I am to use the primary viewport for my modifications, would I remove the 'For Loop' meant to exclude it?b) Even if that is the case, should I have any reservations about not 'playing' with the primary viewports? I am quite new to coding in VBA and AutoCAD in general, and didn't know something such as having more than one viewport in paperspace was a good thing or a bad thing.2. Also, regarding 'what the viewport is looking at', I can see that you are placing a unit vector to tell the viewport which way to 'look.'
However, to clarify, VPcenter is to move the paperspace centre of the view port?If so, then how would I adjust the modelspace centre of the viewport?Thanks in advance again!Riddlez. Thanks for the quick response SEANT!1. A) The code looks quite helpful. However, if I create a new layout it would only have the primary layout and no other, correct? So if I am to use the primary viewport for my modifications, would I remove the 'For Loop' meant to exclude it?By primary viewport I mean the one associated with the Layout View. In other words, even if there were no pviewports drawn in the layout, one (Layout View) would show up in the code.
Fortunately it is always the first item in the layout’s Block so can be excluded by simply starting with the layout Block’s second item (i.e., For I = 1.). I guess to clarify:I am accessing this from excel VBA. I have a handle on the sytax to get into the drawing and what not.The reason for this is that I am using a spreadsheet as the basis for user inputs.So far it's getting a lot more complicated than I thought. The reasons being:-A sample viewport says, when I add a watch to it, it's 19' high by 35' wide, but when I create the new viewport and enter those dimensions it appears more than twice the size of my layout-Similar effect for the centre-I cannot get the target to 'look' where I want it to.I am going to take a look at something I found a while ago that I couldn't grasp on another site and see what I can figure out now that I a better basis from SEANT's help so far.
It had something to do with something like 'acad.thisdrawing.utilities' and a bunch of space conversions.If you know what I'm talking about, by all means share.Riddlez. HELLOO!!My mentor of sorts had time to give me a hand to we figured something that works to pick your target:Essentially, you take the viewport, activate the modelspace and then use the ZoomWindow command to pick your 'target.' That seems like a sensible enough solution. A possible issue would be if the viewport requires particular scale.
If the extents of the ZoomWindow are known, then the viewport would have to be sized to allow for the appropriate ratio. Once that were achieved it would be prudent to set the viewports scale explicitly via PVport.StandardScale or PVport.CustomScale.I should point out that the link you provided gives a good demonstration of the “arcane arts” I alluded to in my earlier post. Luckily for me I'm just using a 1:1 ratio, but your point is still an important point to make.
I planned on developing my code so that you input a width and the program calculates a height depending on the height and width of the modelspace target.I.e. VPHeight = VPWidth.TarHeight/TarWidthRegarding your example of an the arcane art of using translate coordinates: I don't speak arcana.If you wouldn't mind tossing in a few extra comments, it would be appreciated. (I'm having difficultly following a few of the variable names)Just thought I'd add (to direct the 'audience' that you comments will be speaking to):- I don't have a rigorous understanding of the various co-ordinate systems in AutoCAD or most of its many other nuances-I have only been using the VB language since Septemeber and never thought this kind of stuff was possibleAs a result here are some questions:1. I noticed you use '#' in your numbers, that just means to use a displacement vs. An absolute position?2. Is the comment, 'Using a ARCH E sheet, meant to justify the centre location of the new VP being, seemingly, far off?3. Is the 'Modelspace center (WCS)' the point in the model space that the VP is centred upon?
What I failed to figure out and therefore went to my zoom window method?)4. What is 'varViewCtr' retrieving in the line:varViewCtr =.GetVariable('VIEWCTR').
Cmd-A or Ctrl-ASelects all objects in the current layoutCmd-GGroups the selected objectsCmd-HHides AutoCAD windowCmd-MMinimizes the current drawing windowCmd-N or Ctrl-NCreates new drawingCmd-O or Ctrl-OOpens drawingCmd-P or Ctrl-PDisplays the Print/Plot dialog boxCmd-Q or Ctrl-QCloses the programCmd-RRegenerates the current viewportCmd-S or Ctrl-SSaves the current drawing. If the drawing has not been saved yet, the Save Drawing As dialog box is displayedCmd-WCloses the current drawingCmd-Opt-WCloses all drawingsShift-Cmd-GUngroups the selected groupShift-Cmd-PDisplays the Page Setup ManagerShift-Cmd-RRegenerates all viewports in the current layoutShift-Cmd-S orShift-Ctrl-SDisplays the Save Drawing As dialog boxCtrl-ASelects all objects in the current layoutCmd-Opt-MMinimizes all. Fn-F11Hides all open windowsFn-F12Display dashboardCmd-1 or Ctrl-3Opens or closes the Tool Sets paletteCmd-2 or Ctrl-2Opens or closes the Content palette on and offCmd-3 or Ctrl-9Shows or hides the Command WindowCmd-4Opens or closes the Layers paletteCmd-5 or Cmd-Ior Ctrl-1Opens or closes the Properties Inspector paletteCmd-6Toggles the display of the status bar on and offCmd-7Opens or closes the Reference Manager paletteCmd-8 or Ctrl-4Project ManagerCmd-9Material BrowserCmd-0 or Ctrl-0Toggles Clean Screen on and offCmd-Zooms outCmd-+Zooms inCmd-,OptionsCmd. Or Shift-Cmd.Displays the Quick View dialog boxShift-Cmd-CDisplays the Color Palette. Select a new color to make it the current color for new objectsCmd-Opt-HHides the Windows of all other applicationsCmd-Opt-IPropertiesCmd-Opt-TToggles Toolset Palette. EERASE / Removes objects from a drawingEDDDEDIT / Edits single-line text, dimension text, attribute definitions, and feature control framesELELLIPSE / Creates an ellipse or an elliptical arcEREXTERNALREFERENCES /Opens the External References paletteEXEXTEND /Extends objects to meet the edges of other objectsEXITQUIT / Exits the programEXPEXPORT / Saves the objects in a drawing to a different file formatEXTEXTRUDE / Extends the dimensions of a 2D object or 3D face into 3D spaceEXTENDSRFSURFEXTEND /Creates new surface by extending existing surface.
CLARK Hand Pallet Jacks. Batteries / Connectors. TOTALIFT POWER Industrial Batteries. CLARK Parts Industrial Batteries. Service Supplies. Planned Maintenance. Remans Features & Benefits. Safety & Accessories. Mexico Latin Am. Job Opportunities. Request a Quote. Facebook twitter linked YouTube Instagram. These Operator's Manuals are in HTML.
OOFFSET / Creates concentric circles, parallel lines, and parallel curvesOBJECTSELECTION LIMITOPTIONS / Customizes the program settingsOFFSETSRFSURFOFFSET/ Creates a parallel surface or solid by setting an offset distance from a surfaceOPOPTIONS / Customizes the program settingsOPENPROJECTSURFOFFSET / Creates a parallel surface or solid by setting an offset distance from a surfaceORBIT3DORBIT / Rotates the view in 3D space, but constrained to horizontal and vertical orbit onlyOSOSNAP / Sets running object snap modes.