Charlie
Mechanical
- Dec 28, 2015
- 15
I have a step product file containing two products 1 & 2.
product1 contains a hole. Now, i want to add a product 3 in which a hole is made concentric with this hole.
i write following program to excess cylinderical hole surface but it gives error.
Can anyone help that how to access this .
Sub
Dim products1 As Products
Set products1 = CATIA.ActiveDocument.Product.Products
'Add new part to product
Dim product2 As Product
Set product2 = products1.AddNewComponent("Part", "")
Dim PartNumber As String
PartNumber = product2.PartNumber & ".CATPart"
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.Documents.Item(PartNumber)
Dim part1 As part
Set part1 = partDocument1.part
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim body1 As Body
Set body1 = bodies1.Item("PartBody")
part1.InWorkObject = body1
Dim hybridShapeFactory1 As Factory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim Selection1 As selection
Set Selection1 = partDocument1.selection
Dim selection
Set selection = Selection1
Dim InputObjectType(0), Status
InputObjectType(0) = "CylindricalFace"
Status = selection.SelectElement2(InputObjectType, "Select a Cylindrical Face:", True)
Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromName(CylindricalFace.Name) 'showing Error
Dim hybridShapePlaneOffset1 As HybridShapePlaneOffset
Set hybridShapePlaneOffset1 = hybridShapeFactory1.AddNewAxisLine(reference1)
part1.Update
End Sub
I want to use this axis to concentric making of hole feature.
it gives error.Is there another better method.
I also want to use plane in product2 as a limit.
but same problem for creation of reference for plane.
Any suggestion would be great Help.
product1 contains a hole. Now, i want to add a product 3 in which a hole is made concentric with this hole.
i write following program to excess cylinderical hole surface but it gives error.
Can anyone help that how to access this .
Sub
Dim products1 As Products
Set products1 = CATIA.ActiveDocument.Product.Products
'Add new part to product
Dim product2 As Product
Set product2 = products1.AddNewComponent("Part", "")
Dim PartNumber As String
PartNumber = product2.PartNumber & ".CATPart"
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.Documents.Item(PartNumber)
Dim part1 As part
Set part1 = partDocument1.part
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim body1 As Body
Set body1 = bodies1.Item("PartBody")
part1.InWorkObject = body1
Dim hybridShapeFactory1 As Factory
Set hybridShapeFactory1 = part1.HybridShapeFactory
Dim Selection1 As selection
Set Selection1 = partDocument1.selection
Dim selection
Set selection = Selection1
Dim InputObjectType(0), Status
InputObjectType(0) = "CylindricalFace"
Status = selection.SelectElement2(InputObjectType, "Select a Cylindrical Face:", True)
Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromName(CylindricalFace.Name) 'showing Error
Dim hybridShapePlaneOffset1 As HybridShapePlaneOffset
Set hybridShapePlaneOffset1 = hybridShapeFactory1.AddNewAxisLine(reference1)
part1.Update
End Sub
I want to use this axis to concentric making of hole feature.
it gives error.Is there another better method.
I also want to use plane in product2 as a limit.
but same problem for creation of reference for plane.
Any suggestion would be great Help.