Sunday, February 05, 2012
How to create Assembly Patterns?
Last Post 23 Jan 2010 04:02 AM by Sergey. 8 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SergeyUser is Offline
New Member
New Member
Posts:19

--
13 Jan 2010 04:57 AM  

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

JRUser is Offline
New Member
New Member
Posts:91

--
18 Jan 2010 05:47 AM  

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

SergeyUser is Offline
New Member
New Member
Posts:19

--
19 Jan 2010 07:29 AM  
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
JRUser is Offline
New Member
New Member
Posts:91

--
20 Jan 2010 12:16 AM  
By me is all OK. Can you copy the coding hier?
SergeyUser is Offline
New Member
New Member
Posts:19

--
20 Jan 2010 03:57 AM  
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


JRUser is Offline
New Member
New Member
Posts:91

--
20 Jan 2010 06:38 AM  
I don't have any problems with your code!
SergeyUser is Offline
New Member
New Member
Posts:19

--
20 Jan 2010 08:19 AM  
It's really strange...
Probably it depends on the version of Solid Edge( My version is 20.00.00.96 )



JRUser is Offline
New Member
New Member
Posts:91

--
21 Jan 2010 12:09 AM  

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

SergeyUser is Offline
New Member
New Member
Posts:19

--
23 Jan 2010 04:02 AM  

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

You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET