Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to copy the Plane to New Geo Set

Status
Not open for further replies.

Aviatorbarath

New member
Dec 27, 2012
35
US
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
 
Replies continue below

Recommended for you

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) [highlight #FCE94F]' For User Selection (a plane in my case)[/highlight]
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" [highlight #AD7FA8]' created a New geo metric Set[/highlight]
Set Hybridbody1 = hybridBodies1.Item(" Geometric_Set_Plane")
Set hybridShapes1 = Hybridbody1.HybridShapes
part1.InWorkObject = Hybridbody1
part1.Update

Selection1.Paste
 
Code:
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top