Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

[b] 'UNDO' function from within VBscript or VBA[/b]

Status
Not open for further replies.

l3ob

Aerospace
Apr 28, 2004
56
I'm very new at Catia VB programming and have written a program to create normal lines to through points of an open body and normal to a face. When the first line is created the user is prompt to reverse direction YES/NO. If yes, I want to 'UNDO' the created first line, change the length variable and then create the first and subsequent lines in the opposite direction. I've got it all except the 'UNDO' for the first line.


This is the loop:

For i = 1 to countA

Set reference2 = Part1.CreateReferenceFromObject(hybridShapes1.Item(i))

Set hybridShapeLineNormal1 = hybridShapeFactory1.AddNewLineNormal(reference1, reference2, Length, 0, False)

hybridBody2.AppendHybridShape hybridShapeLineNormal

If ( i = 1 ) then
part1.Update
response = msgbox ("Do you want to Flip?",4)
If (response = 6) then
Length=-25.4
>>>undo goes here<<<
msgbox "reversed direction"
i=0
End if
End if
next
 
Replies continue below

Recommended for you

The 'CATIA.StartCommand ("Undo")' seems to go back too far. Within the program, I select a Body of points, select a face, create an Open Body for new lines, create a line through the first point normal the face, and prompt for direction. If the 'Undo' command is used here, it removes the Open Body for the normal lines as well as the first point. All I wanted to do is remove the first created line......
Since the request, I '.add' the line to a selection and delete it. Works fine.
I still would like to know if there is a way to 'UNDO' only the last created element.
 
Hi,

If you've got a reference to the last created object (hybridShapeLineNormal1) , add it to a selection and then delete the object using the selection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor