Reply

duplicator for an occurrence with all relations !!

[ Edited ]

 

I'm thinking bout a duplicator of an asm occurrence, with all relations

so u just duplicate it,

change one dim, and you've got it fixed on a slightly different location.

 

but my problem is, that there's nothing for cloning the object occurrence.

So i tried to rebuild relations with the info from the "old" occurence.

BUT i can't figure out how 2 access the "old" relations and using

the infos 2 rebuild them on the "new" occurrence.

 

I'm workin with vb...

I've picked up the occurrence from the selectset, and brought it into the asm again, deleted the baserelation...and

here's my code 2 recognize the basic 2 relation types.

- pleease help

 For i As Integer = 1 To OldOccRelations.Count

 

            If OldOccRelations.Item(i).Type = SeRealtions.igPlanarRelation3d Then

                Dim OldRelation As SolidEdgeAssembly.PlanarRelation3d = OldOccRelations.Item(i)

                MsgBox(i & " = PlanerRelation")

                'NewOccRelations.AddPlanar(OldRelation.GetElement1(False), OldRelation.GetElement2(False), OldRelation.NormalsAligned, Constrain1, Constrain2)

            ElseIf OldOccRelations.Item(i).Type = SeRealtions.igAxialRelation3d Then

                Dim OldRelation As SolidEdgeAssembly.AxialRelation3d = OldOccRelations.Item(i)

                MsgBox(i & " = AxialRelation")

            Else

                MsgBox(i & " = NOT SUPPROTED !")

            End If

        Next

THX  linus

 

Posted by: Linus Hechinger
Post date: 2/3/2009 2:14:52 AM

1 REPLY

RE: duplicator for an occurrence with all relations !!

[ Edited ]

 

do I need 2 build references ? like below ?

but still can't figure out how 2 get the faces ....

OldOcc is the selected Occurrence for duplication

RefOcc = the Occurrence OldOcc is related to

NewOcc is the duplicated one:

       'select RelationType

        For i As Integer = 1 To OldOccRelations.Count

 

            If OldOccRelations.Item(i).Type = SeRealtions.igPlanarRelation3d Then

                Dim OldRelation As SolidEdgeAssembly.PlanarRelation3d = OldOccRelations.Item(i)

                MsgBox(i & " = PlanerRelation")

                Dim RefOcc = OldRelation.Occurrence2

                Dim RefFace ' = OldRelation.GetGeometry1( ???? )

                Dim NewFace ' = OldRelation.GetGeometry2( ???? )

                Dim Ref2RefFace = Asm_doc.CreateReference(RefOcc, RefFace)

                Dim Ref2NewFace = Asm_doc.CreateReference(NewOcc, NewFace)

                NewOccRelations.AddPlanar(Ref2RefFace, Ref2NewFace, OldRelation.NormalsAligned, Constrain1, Constrain2)

            ElseIf OldOccRelations.Item(i).Type = SeRealtions.igAxialRelation3d Then

                Dim OldRelation As SolidEdgeAssembly.AxialRelation3d = OldOccRelations.Item(i)

                MsgBox(i & " = AxialRelation")

            Else

                MsgBox(i & " = NOT SUPPROTED !")

            End If

        Next

THX

 

Posted by: Linus Hechinger
Post date: 2/4/2009 2:50:10 AM