Macro for External Reference with VB.net and CATIAV5R21
Macro for External Reference with VB.net and CATIAV5R21
(OP)
Hi!
I have the following Problem. I have a product which includes two parts. The first part includes the geometry (surfaces and planes) and the second part includes the actual part based on some of the geometry in the first part.
I'm trying to create an intersection between a plane and a surface which works absolutely fine when I'm doing it by Hand. The "External References" geometrical set is being created and no error is shown.
However, when I try to automate it, I get an error.
This works (if I previously selected the external reference manually, then it is within the external referenecs geometrical set):
reference_CPLANE = currentPart.CreateReferenceFromObject(hybridShapes_ExternalReferences.Item("C___35___A_15__PLN_A320-100"))
reference_LOFT = currentPart.CreateReferenceFromObject(hybridShapes_ExternalReferences.Item("FUSE_____A_15__JOI_A320-100"))
Dim interaction_guidingCurve As HybridShapeIntersection = hybridShapes_FrameProfileGeo.Item("Guidecurve Frame")
interaction_guidingCurve.Element2 = reference_LOFT
interaction_guidingCurve.Element1 = reference_CPLANE
This doesn't work (if I want to get it as an Parameter from another part):
Dim parameters_part_mastergeo_15_cplanes As KnowledgewareTypeLib.Parameters = part_mastergeo_15_cplanes.Parameters
Dim hybridShapePlane_CPLANE As HybridShapePlaneExplicit = parameters_part_mastergeo_15_cplanes.Item("C___35___A_15__PLN_A320-100")
Dim reference_CPLANE As Reference = part_mastergeo_15_cplanes.CreateReferenceFromObject(hybridShapePlane_CPLANE)
Dim interaction_guidingCurve As HybridShapeIntersection = hybridShapes_FrameProfileGeo.Item("Guidecurve Frame")
interaction_guidingCurve.Element1 = reference_CPLANE 'HERE's THE ERROR
PLEASE HELP ME!!! Thanks in advance
I have the following Problem. I have a product which includes two parts. The first part includes the geometry (surfaces and planes) and the second part includes the actual part based on some of the geometry in the first part.
I'm trying to create an intersection between a plane and a surface which works absolutely fine when I'm doing it by Hand. The "External References" geometrical set is being created and no error is shown.
However, when I try to automate it, I get an error.
This works (if I previously selected the external reference manually, then it is within the external referenecs geometrical set):
reference_CPLANE = currentPart.CreateReferenceFromObject(hybridShapes_ExternalReferences.Item("C___35___A_15__PLN_A320-100"))
reference_LOFT = currentPart.CreateReferenceFromObject(hybridShapes_ExternalReferences.Item("FUSE_____A_15__JOI_A320-100"))
Dim interaction_guidingCurve As HybridShapeIntersection = hybridShapes_FrameProfileGeo.Item("Guidecurve Frame")
interaction_guidingCurve.Element2 = reference_LOFT
interaction_guidingCurve.Element1 = reference_CPLANE
This doesn't work (if I want to get it as an Parameter from another part):
Dim parameters_part_mastergeo_15_cplanes As KnowledgewareTypeLib.Parameters = part_mastergeo_15_cplanes.Parameters
Dim hybridShapePlane_CPLANE As HybridShapePlaneExplicit = parameters_part_mastergeo_15_cplanes.Item("C___35___A_15__PLN_A320-100")
Dim reference_CPLANE As Reference = part_mastergeo_15_cplanes.CreateReferenceFromObject(hybridShapePlane_CPLANE)
Dim interaction_guidingCurve As HybridShapeIntersection = hybridShapes_FrameProfileGeo.Item("Guidecurve Frame")
interaction_guidingCurve.Element1 = reference_CPLANE 'HERE's THE ERROR
PLEASE HELP ME!!! Thanks in advance





RE: Macro for External Reference with VB.net and CATIAV5R21
During macros execution, you need to create a few more steps. When you need to bring references from another part, you need first to create a copy and then a paste as result (with link or not, depend from what you want). You can do this step using macro, there are several examples across internet.
I hope that I've helped you.
Tiago Figueiredo
Tooling Engineer
Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...