×
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

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

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

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

(OP)
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

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

Hi, try:

CATIA.StartCommand ("Undo")

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

(OP)
   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.

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

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.

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