Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Creating Parameters Directly under a GeoSet

Status
Not open for further replies.

l3obAero

Aerospace
Jan 23, 2009
13
0
0
US
I have a script that creates String Parameters, and then I have to Cut-And-Paste each one into the appropriate GeoSet that holds fastener points of a variety indicated by the Parameter String. Is there a way to create the parameter directly into the GeoSet without the need for the Cut-And-Paste?
This 'Parameter in the GeoSet' is the format that is used by a piece of Riveting software.
 
Replies continue below

Recommended for you

cut and paste within parameters creation macro.

Code:
Language="VBSCRIPT"

Sub CATMain()

Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part


Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Add()

hybridBody1.Name = "GENERAL NOTES"


Dim parameters1 As Parameters
Set parameters1 = part1.Parameters

Dim strParam1 As StrParam
Set strParam1 = parameters1.CreateString("", "")

strParam1.Rename "GENERAL TOLERANCES"

strParam1.Value = "ASNA2110"

part1.Update 

Set partDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = partDocument1.Selection

selection1.Clear 

selection1.Add strParam1

selection1.Cut 

Set partDocument1 = CATIA.ActiveDocument

Dim selection2 As Selection
Set selection2 = partDocument1.Selection

selection2.Clear 

selection2.Add hybridBody1

selection2.Paste 

Set partDocument1 = CATIA.ActiveDocument

Dim selection3 As Selection
Set selection3 = partDocument1.Selection

selection3.Clear 

Dim parameters2 As Parameters
Set parameters2 = part1.Parameters

Dim parameterSet1 As ParameterSet
Set parameterSet1 = parameters2.RootParameterSet

selection3.Add parameterSet1

selection3.Delete 

End Sub
 
Status
Not open for further replies.
Back
Top