Klogg96
New member
- Nov 23, 2005
- 7
I am a novice VB programmer an have NO real object oriented programming experiance.
Overall Goal: I need a reaction that will check if some geometry changes and update a text file with measured values when changes occure.
Current status: I am writing a VB script in the VB editor that will accomplish the above task when run manually. I will put it into a reaction later. I have tought my self how to retreive parameters but I dont know how to create the text file. Can anyone help me? Here is my VB code:
Language="VBSCRIPT"
Sub CATMain()
sqmTOsqin = (100/2.54)^2
mmTOin = 1/25.4
' Set the active document to CATIA
Set myDoc = CATIA.ActiveDocument
' Determine if the active document is a "CATPart"
Dim strPartName, strCATPart, myPos
strPartName = myDoc.Name
if (InStrRev(strPartName,".CATPart",-1) = 0)_
then MsgBox("Your document should be a .CATPart") : Exit Sub
' Get the parameters from the active part
Set part1 = myDoc.Part
Set parameters1 = part1.Parameters
'Interrogate Parameters for Input Values
Set temp = parameters1.Item("Wing_Area")
Sref = temp.Value * sqmTOsqin
'this will be done many more times for other values
'Create a file containing inputs
'Here is where I would like to write Sref to the text doc
'Dim FileObj as File
'Set FileObj = FileSys.CreateFile("D:\TestFile.txt", True)
End Sub
THANKS FOR YOUR HELP!
Overall Goal: I need a reaction that will check if some geometry changes and update a text file with measured values when changes occure.
Current status: I am writing a VB script in the VB editor that will accomplish the above task when run manually. I will put it into a reaction later. I have tought my self how to retreive parameters but I dont know how to create the text file. Can anyone help me? Here is my VB code:
Language="VBSCRIPT"
Sub CATMain()
sqmTOsqin = (100/2.54)^2
mmTOin = 1/25.4
' Set the active document to CATIA
Set myDoc = CATIA.ActiveDocument
' Determine if the active document is a "CATPart"
Dim strPartName, strCATPart, myPos
strPartName = myDoc.Name
if (InStrRev(strPartName,".CATPart",-1) = 0)_
then MsgBox("Your document should be a .CATPart") : Exit Sub
' Get the parameters from the active part
Set part1 = myDoc.Part
Set parameters1 = part1.Parameters
'Interrogate Parameters for Input Values
Set temp = parameters1.Item("Wing_Area")
Sref = temp.Value * sqmTOsqin
'this will be done many more times for other values
'Create a file containing inputs
'Here is where I would like to write Sref to the text doc
'Dim FileObj as File
'Set FileObj = FileSys.CreateFile("D:\TestFile.txt", True)
End Sub
THANKS FOR YOUR HELP!