How to create Assembly Patterns?

 

From the API reference it is not clear how to use function AssemblyPatterns.Create( PatternName, MasterOccurrences, FeaturePattern, ReferenceFeature) and what arguments to pass.

I used the following sample in VB to create a new AssemblyPattern but it always failed.

Dim objOccArray(1 To 1) As Object

Set objOccArray(1) = objAssmDoc.Occurrences(2)

Dim Occ As SolidEdgeAssembly.Occurrence

Occ = objAssmDoc.Occurrences(1)

Dim objPart As SolidEdgePart.PartDocument

objPart = Occ.OccurrenceDocument       

objPattern = objPart.Models(1).Patterns.Item(1)

HoleObj = objPart.Models(1).Holes(1)

objAsmPattern = objAssmDoc.AssemblyPatterns.Create("MyPattern", objOccArray, objPattern, HoleObj) 

I also tried to get parameters from already existing AssemblyPattern and used them to create another AssemblyPattern. To get parameters I used function AssemblyPatterns.GetInputs( ... ). Then I deleted the old AssemblyPattern and tried to create a new one using the retrieved parameters. But AssemblyPatterns.Create(...)  failed again.

Thanks

 

Posted by: Sergey Sergeenko
Post date: 1/12/2010 10:57:50 PM

8 REPLIES

RE: How to create Assembly Patterns?

 

Hi Sergey,

 

your way is good, but your objects are from Part and not from Assembly. You must create references extra for the Assembly:

 

Dim objRefPattern as Object

objRefPattern = objAssmDoc.CreateReference(Occ, objPattern)

Dim objRefHole as Object

objRefHole = objAssmDoc.CreateReference(Occ, HoleObj)

'and

objAsmPattern = objAssmDoc.AssemblyPatterns.Create("MyPattern", objOccArray, objRefPattern, objRefHole)

 

Regards

JR

 

Posted by: JR
Post date: 1/17/2010 11:47:42 PM

RE: How to create Assembly Patterns?

You are absolutely right!

It's supposed from the definition of the method that the arguments must be reference-objects

The only problem that creating reference of feature has always failed (At least I couldn't do that)

 

Thanks

 

Posted by: Sergey Sergeenko
Post date: 1/19/2010 1:29:26 AM

RE: How to create Assembly Patterns?

By me is all OK. Can you copy the coding hier?

 

Posted by: JR
Post date: 1/19/2010 6:16:32 PM

RE: How to create Assembly Patterns?

Here is my test code

 

Dim Occ1 As SolidEdgeAssembly.Occurrence

Occ1 = objAsmDoc.Occurrences.Item(1)

 

Dim PartDoc As SolidEdgePart.PartDocument

PartDoc = Occ1.OccurrenceDocument

 

Dim Hole As SolidEdgePart.Hole

Hole = PartDoc.Models.Item(1).Holes.Item(1)

Dim AsmHole As Object

AsmHole = objAsmDoc.CreateReference(Occ1, Hole) 'exception E_FAIL

 

Dim Pattern As SolidEdgePart.Pattern

Pattern = PartDoc.Models.Item(1).Patterns.Item(1)

Dim AsmPattern As Object

AsmPattern = objAsmDoc.CreateReference(Occ1, Pattern) 'exception E_FAIL

 

 

 

 

Posted by: Sergey Sergeenko
Post date: 1/19/2010 9:57:33 PM

RE: How to create Assembly Patterns?

I don't have any problems with your code!

 

Posted by: JR
Post date: 1/20/2010 12:38:26 AM

RE: How to create Assembly Patterns?

It's really strange...

Probably it depends on the version of Solid Edge( My version is 20.00.00.96 )

 

 

 

 

 

Posted by: Sergey Sergeenko
Post date: 1/20/2010 2:19:21 AM

RE: How to create Assembly Patterns?

 

My version is 20.00.15.05. Try again after instalation of Service Pack 15.

 

Posted by: JR
Post date: 1/20/2010 6:09:57 PM

RE: How to create Assembly Patterns?

 

After installing SP15 Solid Edge all the time throws exception when I call the method

 

Dim Occs As SolidEdgeAssembly.Occurrences

Occs = objAsmDoc.Occurrences

 

I even don't know what to do... probably somehow initialize assembly or something else

 

Posted by: Sergey Sergeenko
Post date: 1/22/2010 10:02:14 PM