×
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

How to copy the Plane to New Geo Set

How to copy the Plane to New Geo Set

How to copy the Plane to New Geo Set

(OP)
Hi

I wanted to select a plane manually (user input). Once user selects the Plane (parent Geomertic Set is Unknown in this case), i want tht plane to be copied to the new geometric set (Geo_Set_Plane) which i created.

Any suggestions

How to add to the selection and copy it to the new geometric set

Thanks
Barath

RE: How to copy the Plane to New Geo Set

(OP)
This is wat i tried IN catvba

Dim Selection1 as object
Set Selection1 = CATIA.ActiveDocument.Selection


MsgBox "Select a Plane"
Status = sel.SelectElement2(inpt2, "Select a Plane (" & msgboxtext & "), (C)EMA", False) ' For User Selection (a plane in my case)
Set SelectedElement1 = sel.Item(1).Value
Selection1.Add
Selection1.Copy

Set hybridShapeFactory1 = part1.HybridShapeFactory
Set bodies1 = part1.Bodies
Set hybridBodies1 = part1.HybridBodies
Dim Hybridbody1 As HybridBody
Set Hybridbody1 = hybridBodies1.Add()
Hybridbody1.Name = " Geometric_Set_Plane" ' created a New geo metric Set
Set Hybridbody1 = hybridBodies1.Item(" Geometric_Set_Plane")
Set hybridShapes1 = Hybridbody1.HybridShapes
part1.InWorkObject = Hybridbody1
part1.Update

Selection1.Paste

RE: How to copy the Plane to New Geo Set

CODE --> CATScript

ub CATMain()

Set oPartDocument = CATIA.ActiveDocument
Set oSelection = oPartDocument.Selection
Dim oInputType(0)
Dim oStatus
MsgBox "Select a PLane"
oInputType(0) = "Plane"
oStatus = oSelection.SelectElement2(oInputType, "Select a Plane", True)
If (oStatus = "Cancel") Then
Exit Sub
End If
oSelection.Copy 
Dim  part1 AS Part 
''''' Create Open Body -------------------------
Dim HB1 As HybridBodies
Set HB1 = CATIA.ActiveDocument.Part.HybridBodies
Dim Hierarchie1  
Set Hierarchie1 = HB1.Add
Hierarchie1.Name = "Geometric_Set_Plane"
Set oPartDocument = CATIA.ActiveDocument
Set part1 = oPartDocument.Part
Set OpenBody1 = part1.InWorkObject       
part1.InWorkObject = HB1
oSelection.Clear
oSelection.Add(HB1)
oSelection.Paste
part1.Update 
End Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

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