×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

copy a point

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:

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 
the problem here is that it works with selection! that make me upset!!!
help please! thank you

RE: copy a point

well copy and paste work with selection.

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.

Eric N.
indocti discant et ament meminisse periti

RE: copy a point

(OP)
hi
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 Sub 

but i want to place the copy in an hybridbody2 named "set geometrique.1" in part2
thx :)))

RE: copy a point

selection1 was defined on active document (part1) when you do selection1.Paste you actually do part1.Paste !

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.

Eric N.
indocti discant et ament meminisse periti

RE: copy a point

(OP)
I want a special paste as a result!
how can I do that?
if not there will be a problem with the update! the point is deactivated

RE: copy a point

check your online doc about selection... you should find your answer there

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources