I would like to bring this discussion to surface again.
I am trying similar workflow with iAssemblies.
In Inventor 2013
Manually : I do a rightclick on level of Details and New Substitute > Derived Assembly
That adds the substitute and creates it as I go. I have to again manually Suppress/Exclude
from Derived assembly dialog box.
I tried to automate this BUT
{Code}
Sub Cmd_Substitute_Assm()
' Open the factory document
Dim oFacDoc As AssemblyDocument
Set oFacDoc = ThisApplication.ActiveDocument
Dim oCompdef As AssemblyComponentDefinition
Set oCompdef = oFacDoc.ComponentDefinition
Dim oiPrtFac As iAssemblyFactory
Set oiPrtFac = oCompdef.iAssemblyFactory
'Get filename to get foldername
Dim Filename As String
Filename = oFacDoc.FullDocumentName
Debug.Print Filename
Dim opath As String
opath = Left(Filename, InStrRev(Filename, "\"))
Debug.Print opath
Dim oRow As iAssemblyTableRow
Set oRow = oiPrtFac.DefaultRow
Debug.Print oRow.MemberName
Dim UnitNum As String
UnitNum = oRow.MemberName
Dim MasterLOD As LevelOfDetailRepresentation
Set MasterLOD = oCompdef.RepresentationsManager.LevelOfDetailRepresentations.Item(1)
Call MasterLOD.Activate
1.'Add Subtitute : I think this only adds the existing substitute does not create one. , Correct ?
Dim Subtitute As LevelOfDetailRepresentation
Set Subtitute = oCompdef.RepresentationsManager. _
LevelOfDetailRepresentations.AddSubstitute(opath & "Substitutes\" & UnitNum & ".ipt", False)
End Sub
{Code}
2.Is there a way by which I can replicate the steps as I do manually ?
Hello Sanjay, In your previous post you had
' ~~~~ OPTIONS ~~~~
'Scale factor
oDerivedAssyDef.ScaleFactor = 1
'RMM flag
oDerivedAssyDef.ReducedMemoryMode = True
'Include all available components ..................(from old code)
3. 'In my case, I want to exclude the excluded components as per the iassembly definition.
' Can you please illustrate that ?
'oDerivedAssyDef.InclusionOption =_
'DerivedComponentOptionEnum.kDerivedIncludeAll
Precisely: I am trying to create a Substitute LOD for each member in iassembly.
So that the overall assembly will be easier.
Thanks
Hi,
I would suggest you take a look at the example in API help reference.
LevelOfDetailRepresentations.AddSubstitute Method
I think this sample answered your questions. The attachment is a snapshot of this example.