Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

General configuration and assemby help 1

Status
Not open for further replies.

deschamos

Electrical
Jun 22, 2009
10
0
0
US
OK, so I have an assembly with a bunch of different configurations in it.
-What is the easiest way to view the custom properties of a configuration?
-Is there a way to select all of the parts whose current configuration share a custom property?
Thanks,
-Jake Deschamps
 
Replies continue below

Recommended for you

I was thinking something more along the lines of getting the information from clicking on the model itself, so all of the data would be easier to visualize.

Basically the assembly is a large room of servers that are different configurations with custom properties.

So primarily, I want have it so that I can, ideally, right-click on a server and go to an option and have it tell me the custom properties.

The other thing I want is to do a search, say all servers whose Client is Company A, and have it be able to indicate on the model (highlight) which servers have that trait.
 
deschamos,

It sounds to me like you want to view the configuration data of sub-assemblies.

Create an assembly or arrangement drawing.

Create a custom bill of material template that displays the parameters you want.

Insert a bill of material into your drawing.

Add item balloons.

All of this stuff can be massively customized.

Critter.gif
JHG
 
If I correctly understand you have the following request1:

1) Say you have assembly with several components (both parts and assemblies with multi configurations). And you need quick and easy solution to get all the configuration specific custom properties of the referenced configuration of the component

2) Say you have the same assembly and want to preselect all the components configuration specific custom properties of the referenced configuration is for example (Client = Company A).

Am I correct?

If so it can be implemented through the macro. Please confirm that my comments are correct and I can help you to write this macro.

Artem Taturevich
CSWP
 
Thank you, but since the time I wrote this thread, I discovered that this can be done with the Property Tab Manager (I think that's what it's called).
 
And what about #2: searching through the components with specific custom properties? I think Property Tab Builder (is it the Property Tab Manager that are you refering to? It is on the Task Pane view) doesn't provide this functionality. Or I'm mistaken?

Artem Taturevich
CSWP
 
You are correct, it does not provide this feature. I was thinking of using tags for this, but if you think writing a macro is a better option, then I ask for your help.
 
Please take a look at the following macro. Specify the custom property field as "CustPropField" constant and it's value as "CustPropVal" constant as the search filter.

For example with the following filters:

Const CustPropField As String = "Client"
Const CustPropVal As String = "Company A"

All the sub-assembly and components on every level which have the configuration specific custom property for the corresponding referenced configuration in the assembly: Client = Company A, will be preselected and their names will be output to immediate window of the VBA Editor (Menu->View->Immediate Window (Ctrl+G))

Note. The suppressed/lightweigh components aren't considered.

- - - - - - - - - - - - - - - -
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssy As SldWorks.AssemblyDoc
Dim bRet As Boolean

Const CustPropField As String = "Client"
Const CustPropVal As String = "Company A"

Sub main()

Dim swConf As SldWorks.Configuration
Dim swRootComp As SldWorks.Component2

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

swModel.ClearSelection2 True

Set swConf = swModel.GetActiveConfiguration

Set swRootComp = swConf.GetRootComponent

TraverseComponent swRootComp

End Sub

Sub TraverseComponent(swComp As SldWorks.Component2)

Dim vChildComp As Variant
Dim swChildComp As SldWorks.Component2
Dim swCompConfig As SldWorks.Configuration
Dim sPadStr As String
Dim i As Long

CheckCustProps swComp

vChildComp = swComp.GetChildren

For i = 0 To UBound(vChildComp)

Set swChildComp = vChildComp(i)

TraverseComponent swChildComp

Next i

End Sub

Sub CheckCustProps(swComp As SldWorks.Component2)

Dim swCompModel As SldWorks.ModelDoc2
Dim swCustPrpMgr As SldWorks.CustomPropertyManager

Set swCompModel = swComp.GetModelDoc2

If swCompModel Is Nothing Then
Exit Sub
End If

Set swCustPrpMgr = swCompModel.Extension.CustomPropertyManager(swComp.ReferencedConfiguration)

Dim val As String
Dim resVal As String
swCustPrpMgr.Get3 CustPropField, False, val, resVal

If resVal = CustPropVal Then

Debug.Print swComp.Name2
swComp.Select4 True, Nothing, False

End If

End Sub
- - - - - - - - - - - - - - - -

If you need some more assistance I'm 'open' for help.

Artem Taturevich
CSWP
 
Status
Not open for further replies.
Back
Top