mayrou
Electrical
- Jan 8, 2014
- 55
Hi!!!
I'm having some trouble getting update to work the way I'm expecting it to.
so if anyone has a better understanding of the best way to use this method it would be appreciated,
th u ))
I'm having some trouble getting update to work the way I'm expecting it to.
Code:
Dim productDocument1 As Document
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocument1.Product
Dim partDocument1 As Document
Set partDocument1 = documents1.Item("part.1")
Dim part1 As Part
Set part1 = partDocument1.Part
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim shapeFactory1 As Factory
Set shapeFactory1 = part1.ShapeFactory
Dim body1 As Body
Set body1 = bodies1.Item("Corps principal")
Dim shapes1 As Shapes
Set shapes1 = body1.Shapes
Dim hybridShapes1 As HybridShapes
Set hybridShapes1 = body1.HybridShapes
MsgBox "selectionnez un trou"
Dim InputObjectType(0), Status1
InputObjectType(0)="Hole"
Status1=selection1.SelectElement2(InputObjectType,"Select un trou",false)
If Status1 = "Cancel" Then selection1.Clear: Exit Sub
nom_trou= oHole.Name
Dim partDocument2 As Document
Set partDocument2 = documents1.Item("part.2")
Dim part2 As Part
Set part2 = partDocument2.Part
Dim bodies2 As Bodies
Set bodies2 = part2.Bodies
Dim body2 As Body
Set body2 = bodies2.Item("Corps principal")
Dim sketches1 As Sketches
Set sketches1 = body2.Sketches
Dim shapes2 As Shapes
Set shapes2 = body2.Shapes
Dim hole2 As Shape
Set hole2 =shapes2.Item(nom_trou)
Dim sketch2 As Sketch
Set sketch2 = hole2.Sketch
Dim reference_piece As Reference
Set reference_piece= part2.CreateReferenceFromObject( hole2)
Set reference1 = Selection1.Item(1).value
Dim hybridShapeFactory1 As Factory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim hybridShapePointCenter1 As HybridShapePointCenter
Set hybridShapePointCenter1 = hybridShapeFactory1.AddNewPointCenter(reference_piece)
Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies
Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Item("Set géométrique.1")
hybridBody1.AppendHybridShape hybridShapePointCenter1
part1.InWorkObject = hybridShapePointCenter1
part1.Update
so if anyone has a better understanding of the best way to use this method it would be appreciated,
th u ))