Hi,
I would like to know, if there is any way to create a new 'FeatureBasedPattern' within an assembly document. I have 2 assembly occurences - parts. In the Part1 i created a RectangularPattern of workpoints. The Part2 is going to be used in the new pattern. I tried the following VBA code, but it doesn't work.
___________________________________________________________________________________________________
Dim oAssDoc As AssemblyDocument
Set oAssDoc = ThisApplication.ActiveDocument
Dim oAssDef As AssemblyComponentDefinition
Set oAssDef = oAssDoc.ComponentDefinition
Dim oPart1 As ComponentOccurrence
Set oPart1 = oAssDef.Occurences.Item(1)
Dim oPart2 As ComponentOccurrence
Set oPart2 = oAssDef.Occurences.Item(2)
Dim oTG As TransientObjects
Set oTG = ThisApplication.TransientObjects
Dim oObjCol As ObjectCollection
Set oObjCol = oTG.CreateObjectCollection()
oObjCol.Add oPart2
Dim oExistingPattern As PartFeature
Set oExistingPattern = oPart1.Features.RectangularPatternFeatures.Item("PatternForAssembly")
'Dim oAssemblyPattern As FeatureBasedOccurrencePattern
Call oAssDef.OccurrencePatterns.AddFeatureBasedPattern(oObjCol, oExistingPattern)
___________________________________________________________________________________________________
The Call function breaks with: "Invalide procedure call or argument". I also tried "Set oAssemblyPattern = oAssDef.OccurencePatterns.etc...." instead of Call function, but with the same result. Same error for declaration change of "oAssemblyPattern" to "FeatureBasedOccurrencePatternProxy".
What am I doing wrong?
I am using INV2014, win7/64bit
Thank you for any suggestions,
Marek
Solved! Go to Solution.
Solved by marek.sykora. Go to Solution.
Ok, i don't need help anymore... The point was the proxy geometry wich had to be created from the part pattern.
can you post your solution because im stuck with the same problem
thx in advance
'Hi, i won't write here the "SET" declarations of all objects. I'll write just "DIMs".
'I have a Rect. pattern named "POINTS" created in a part "Belt". The part is palced in an assembly. Then i have another part "holder" placed in the same assembly wich is fully constrained. I want to use the "holder" and the "POINTS" as inputs into the feature based pattern.
Dim oBeltInAss As ComponentOccurrence
Dim oBeltDef As PartComponentDefinition
Dim oAssDef As AssemblyComponentDefinition
Dim oObjCol As ObjectCollection
Dim oHolderInAss As ComponentOccurrence
'First, you have to get a pattern feature from the part
DIm oPatt As PartFeature
Set oPatt = oBeltDef.Features.RectangularPatternFeatures.Item("POINTS") 'or you can choose by number - for ex. Item(1)
'Then u have to create the proxy bacause of working in assembly
Dim oPattProxy As RectangularPatternFeatureProxy
Call oBeltInAss.CreateGeometryProxy(oPatt, oPattProxy)
'Now you can create the FeatureBasedPattern
Dim oFeatBasedPatt As FeatureBasedOccurrencePattern
oObjCol.Clear
oObjCol.Add oHolderInAss
Call oAssDef.OccurrencePatterns.AddFeatureBasedPattern(oObjCol, oPattProxy)
Set oPoleDilku2 = oAssDef.OccurrencePatterns.Item(2)
'Now the pattern shoud be created.
'Hope this helps at least a bit.:-) And sorry for my english..:-)
thank you, i already figured it out, but it's nice to have a confirmation
greeting Burn
ps my english sucks aswel;)