Selecting specific view in VBA im Solidworks
I have a macro that uses the following code to select a view in a SolidWorks drawing.
Set swDraw = swApp.ActiveDoc Set swView = swDraw.GetFirstView Set swView = swView.GetNextView
How do I change this to select a view named "
swView object is of type
iView you can get the name using the
GetName2 method. So you can then enumerate over each view in the drawing using the
GetNextView method you already were, and just check if the name matches.
It's not really well documented, but for what it's worth the
GetNextView method returns a null reference pointer (e.g.
nothing in vb) after the end of the enumeration.
Set swDraw = swApp.ActiveDoc Set swView = swDraw.GetFirstView Do While Not swView is Nothing If swView.GetName2 = "Drawing View1" then Exit Do Set swView = swView.GetNextView Loop
Select drawing views and delete them macro, Hello, I am trying to create macro, which would copy one drawing view from one sheet to another. Everything was going fine until now. Select Entity in Drawing View Example (VBA) This example shows how to select a model face, edge, or vertex in a drawing view and dimension it. '----- ' Preconditions: ' 1. Open a part or fully resolved assembly. ' 2. Verify that the specified template exists. ' 3.
- Use this method:
- Where Name = "Drawing View1"
- Type = "DRAWINGVIEW"
- X, Y, Z = 0 if not known
- return type (value) is boolean
Dim instance As IModelDocExtension value = instance.SelectByID2(Name, Type, X, Y, Z, Append, Mark, Callout, SelectOption)
how to select a drawing view?, But the view is going to be of a assembly. So I let the macro make a assembly and I want to have a left view of that assembly. ' view can be quite problematic. To address this, use ' IView::SelectEntity ' ' Thus, given an entity in the context of the model, this ' method selects the entity in the context of the drawing ' view. ' ' This code shows how to use this method to assist in ' adding a dimension to a drawing view. ' ' Preconditions: ' 1. Part or assembly is open. ' 2.
Set Part = swApp.OpenDoc6(drawpathandfile, 3, 0, "", longstatus, longwarnings) Dim swDrawing As Object Set swDrawing = Part Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView myModelView.FrameLeft = 0 myModelView.FrameTop = 33 Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowMaximized swApp.ActivateDoc2 "Drawing View1", False, longstatus Set Part = swApp.ActiveDoc Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowMaximized
Reposition Drawing Views based on user selection, I'm revisiting an abandoned idea for a macro that will reposition pre-selected drawing views based on the order that the user selected them. Get Selected Objects and Types Example (VBA) This example shows how to determine what is currently selected. NOTE: You can select many features and entities in SOLIDWORKS. In most cases, it is obvious what is selected, but sometimes it is not clear or it is ambiguous.
Selecting faces in Macro,, Hi guys, I'm trying to record a macro; 1) while working with a non .SLDPRT CAD "SelectByID2" function (for selecting faces) doesn't work, So, all other steps are fail. See the reply in context You have the possibility to manage parameters and choose whether to accept certain cookies while on the site. Selecting the object (elements such as Face, Vertex, Edge or Annotation) by coordinates (i.e. Nameparameter is empty and X, Y, Zparameters are specified) might fail if the target entity is outside of the active view orientation. I.e. if it is not possible to select this element from the user interface at the current view position.
part by part selection macro, Nedless to say I'm a newbie in the macro/VBA universe but I have been given a task to create a macro that would contain a loop in which the� I have the selection string/id of the component in Assembly in Assembly, need a method to select the same in Drawing based on Drawing View1 for example. Select component in feature tree using its name via SOLIDWORKS API Option Explicit. Dim swApp As SldWorks.SldWorks. Dim swModel As SldWorks.ModelDoc2. Dim swSelectionMgr As SldWorks.SelectionMgr
Get View Name, Is there a way to get the current view orientation name in a part or assembly using the API (ex "*Front", I have a macro that I want to perform a certain operation based upon the current view orientation name. I am curious to find out if you can get the rest working as you want! Select Case swModel. Search 'Create Specific Dimension in a Sketch Example (VBA)' in the SOLIDWORKS Knowledge Base. Provide feedback on this topic SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation.