Question:
Does anyone know how to get DrawingComponent.Select orComponent2.Select3 to work?
Development Environment:
SolidWorks 2007 API
VB .NET Add-in
Context:
An assembly is shown in a View within a Sheet in a Drawing.
Desired Operation:
Given the name of a component in the assembly, highlight thecomponent in the View.
Procedure:
Get the root DrawingComponent for the View.
Create a SelectData for the model (oSelectData).
Walk the component tree until the target component is found.(Component is identified by configuration name.)
Problem:
Neither of the following two calls has any effect:
oDrawingComponent.Select(False, oSelectData)
where oDrawingComponent is a DrawingComponent object.
oComponent.Select3(False, oSelectData)
where oComponent = oDrawingComponent.Component
Attempted Solution:
Continue walking the component tree, attempting to select theconstituent components. I called oDrawingComponet.Select andoComponent.Select3 at every level in the component tree. None ofthem had any effect.
Inefficient Solution:
While walking the component tree, get edge entities for eachsubcomponent.
vEdges = oView.GetVisibleEntities(oComponent,swViewEntityType_Edge)
For each edge entity, call oEntity.Select4(True, oSelectData)
The problem is that this takes a long time, especially forcomponents with many subcomponents.
Thanks for your help.
Greg
SolidworksApi macros
Does anyone know how to get DrawingComponent.Select orComponent2.Select3 to work?
Development Environment:
SolidWorks 2007 API
VB .NET Add-in
Context:
An assembly is shown in a View within a Sheet in a Drawing.
Desired Operation:
Given the name of a component in the assembly, highlight thecomponent in the View.
Procedure:
Get the root DrawingComponent for the View.
Create a SelectData for the model (oSelectData).
Walk the component tree until the target component is found.(Component is identified by configuration name.)
Problem:
Neither of the following two calls has any effect:
oDrawingComponent.Select(False, oSelectData)
where oDrawingComponent is a DrawingComponent object.
oComponent.Select3(False, oSelectData)
where oComponent = oDrawingComponent.Component
Attempted Solution:
Continue walking the component tree, attempting to select theconstituent components. I called oDrawingComponet.Select andoComponent.Select3 at every level in the component tree. None ofthem had any effect.
Inefficient Solution:
While walking the component tree, get edge entities for eachsubcomponent.
vEdges = oView.GetVisibleEntities(oComponent,swViewEntityType_Edge)
For each edge entity, call oEntity.Select4(True, oSelectData)
The problem is that this takes a long time, especially forcomponents with many subcomponents.
Thanks for your help.
Greg
SolidworksApi macros