Inventor General Discussion

Reply
Member
marek.sykora
Posts: 3
Registered: ‎04-24-2012
Message 1 of 5 (192 Views)
Accepted Solution

FeatureBasedPattern

192 Views, 4 Replies
12-06-2013 10:17 AM

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

Member
marek.sykora
Posts: 3
Registered: ‎04-24-2012
Message 2 of 5 (140 Views)

Re: FeatureBasedPattern

12-11-2013 12:10 PM in reply to: marek.sykora

Ok, i don't need help anymore... The point was the proxy geometry wich had to be created from the part pattern.

Contributor
Burnit87
Posts: 19
Registered: ‎02-27-2014
Message 3 of 5 (83 Views)

Re: FeatureBasedPattern

03-21-2014 12:48 AM in reply to: marek.sykora

can you post your solution because im stuck with the same problem

thx in advance

BP
Member
marek.sykora
Posts: 3
Registered: ‎04-24-2012
Message 4 of 5 (67 Views)

Re: FeatureBasedPattern

03-21-2014 12:24 PM in reply to: marek.sykora

'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..:-)

Contributor
Burnit87
Posts: 19
Registered: ‎02-27-2014
Message 5 of 5 (50 Views)

Re: FeatureBasedPattern

03-26-2014 12:22 AM in reply to: marek.sykora

thank you, i already figured it out,  but it's nice to have a confirmation

greeting Burn

ps my english sucks aswel:smileywink:

BP

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube