copy a point
copy a point
(OP)
hi!
I want to create a macro that copy a point
named "pt1" from an hybridbody1 to another hybridbody2
when i record a macro of this action:
the problem here is that it works with selection! that make me upset!!!
help please! thank you
I want to create a macro that copy a point
named "pt1" from an hybridbody1 to another hybridbody2
when i record a macro of this action:
CODE --> vbs
Sub CATMain()
Dim productDocument1 As Document
Set productDocument1 = CATIA.ActiveDocument
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim partDocument1 As Document
Set partDocument1 = documents1.Item("387-181-953-0.CATPart")
Dim part11 As Part
Set part11 = partDocument1.Part
Dim hybridBodies11 As HybridBodies
Set hybridBodies11 = part11.HybridBodies
Dim hybridBody11 As HybridBody
Set hybridBody11 = hybridBodies11.Item("Construction maquette")
Dim hybridShapes11 As HybridShapes
Set hybridShapes11 = hybridBody11.HybridShapes
Dim zeroDimFeatVertexOrWireBoundaryMonoDimFeatVertex1 As Boundary
Set zeroDimFeatVertexOrWireBoundaryMonoDimFeatVertex1 = hybridShapes11.GetItem("pt1")
'selection1.AddzeroDimFeatVertexOrWireBoundaryMonoDimFeatVertex1 help please! thank you





RE: copy a point
looking at your script: you Dim your zero[...]Vertex as Boundary and you set a "pt1" to it. I hope "pt1" is a a boundary feature.
indocti discant et ament meminisse periti
RE: copy a point
this macro may be useful for you!
it generate a copy of a point "point1" from an hybridbody1 named "construction" in part1 to the same hybrid body
CODE --> vbs
Sub CATMain() Dim productDocument1 As Document Set productDocument1 = CATIA.ActiveDocument Dim selection1 As Selection Set selection1 = productDocument1.Selection selection1.Clear Dim documents1 As Documents Set documents1 = CATIA.Documents Dim partDocument1 As Document Set partDocument1 = documents1.Item("part1.CATPart") Dim part1 As Part Set part1 = partDocument1.Part Dim hybridBodies1 As HybridBodies Set hybridBodies1 = part1.HybridBodies Dim hybridBody1 As HybridBody Set hybridBody1 = hybridBodies1.Item("Construction") Dim hybridShapes1 As HybridShapes Set hybridShapes1 = hybridBody1.HybridShapes Dim hybridShapePointCenter1 As HybridShape Set hybridShapePointCenter1 = hybridShapes1.Item("Point.1") selection1.Add hybridShapePointCenter1 selection1.Copy Dim partDocument2 As Document Set partDocument2 = documents1.Item("part2.CATPart") Dim part2 As Part Set part2 = partDocument2.Part Dim hybridBodies2 As HybridBodies Set hybridBodies2 = part2.HybridBodies Dim hybridBody2 As HybridBody Set hybridBody2 = hybridBodies2.Item("Set géométrique.1") selection1.Paste part2.Update End Subbut i want to place the copy in an hybridbody2 named "set geometrique.1" in part2
thx :)))
RE: copy a point
check the very good GTWiki on this problem :
Also the point you copy is a center, don't you think you also need to copy the curve/circle needed for the definition of the point?
Unless you get the XYZ of part1.point1 and create (not copy/paste) a new XYZ point (not center) in part2.
indocti discant et ament meminisse periti
RE: copy a point
how can I do that?
if not there will be a problem with the update! the point is deactivated
RE: copy a point
indocti discant et ament meminisse periti