Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sew surface with VB Catia

Status
Not open for further replies.

dddn

Mechanical
Nov 26, 2022
35
IT
Good morning, everyone.
Below I recorded the generation of the "Sew surface"; does anyone know how to give the references of the faces not using the "part1.CreateReferenceFromBRepName("RSur:(Fac..." ?
By the use of the "Topology.CGMFace,sel", I can already select the faces, and I want to use these to generate the "sew surface". So I would like to insert in reference 1, reference 2, reference n the faces preselected by the "Topology.CGMFace,sel"
Thank you very much to all the forum users

''''''''''''''''''''''''''''''''''''''''''''''
Language="VBSCRIPT"

Sub CATMain()

Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim hybridShapeFactory1 As Factory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim bodies1 As Bodies
Set bodies1 = part1.Bodies

Dim body1 As Body
Set body1 = bodies1.Item("PartBody")

Dim shapes1 As Shapes
Set shapes1 = body1.Shapes

Dim pad1 As Shape
Set pad1 = shapes1.Item("Prisma.1")

Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;4)));None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", pad1)

Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;3)));None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", pad1)

Dim hybridShapeAssemble1 As HybridShapeAssemble
Set hybridShapeAssemble1 = hybridShapeFactory1.AddNewJoin(reference1, reference2)

hybridShapeAssemble1.SetConnex 1

hybridShapeAssemble1.SetManifold 1

hybridShapeAssemble1.SetSimplify 0

hybridShapeAssemble1.SetSuppressMode 0

hybridShapeAssemble1.SetDeviation 0.001000

hybridShapeAssemble1.SetAngularToleranceMode 0

hybridShapeAssemble1.SetAngularTolerance 0.500000

hybridShapeAssemble1.SetFederationPropagation 0

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Gruppo geometrico.1")

hybridBody1.AppendHybridShape hybridShapeAssemble1

part1.InWorkObject = hybridShapeAssemble1

part1.Update

part1.Update

End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
Replies continue below

Recommended for you

Update

Sub CATMain()

Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument

Set part1 = partDocument1.Part

Set selection1= partDocument1.Selection

Dim hybridShapeFactory1 As Factory

Set hybridShapeFactory1 = part1.HybridShapeFactory

selection1.Search("Topology.CGMFace,sel")

msgbox selection1.Count2 & " Facce che sono state cucite tra loro"

For i=1 To selection1.Count

msgbox selection1.Item(i).Value.Parent

next

Set reference1 = part1.CreateReferenceFromName(selection1.Item(1).Value.Name)
Set reference2 = part1.CreateReferenceFromName(selection1.Item(2).Value.Name)

Set hybridShapeAssemble1 = hybridShapeFactory1.AddNewJoin(reference1, reference2)

hybridShapeAssemble1.SetConnex 1
hybridShapeAssemble1.SetManifold 1
hybridShapeAssemble1.SetSimplify 0
hybridShapeAssemble1.SetSuppressMode 0
hybridShapeAssemble1.SetDeviation 0.001000
hybridShapeAssemble1.SetAngularToleranceMode 0
hybridShapeAssemble1.SetAngularTolerance 0.500000
hybridShapeAssemble1.SetFederationPropagation 0

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Gruppo geometrico.10")

hybridBody1.AppendHybridShape hybridShapeAssemble1

part1.InWorkObject = hybridShapeAssemble1



End Sub

'''''''''''''
The macro ending but the model is not Update.
I think that the error it is in the reference 1 and 2 because I used CreateReferenceFromName and not CreateReferenceFromBRepName.
Help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top