×
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

Macro to run analysis until a displacement vector equals a certain value

Macro to run analysis until a displacement vector equals a certain value

Macro to run analysis until a displacement vector equals a certain value

(OP)
Hello there,

This will be my first post on the forum so thanks for having me!

I am looking to write a catia macro that will run an analysis until the displacement vector that I created equals a value that a user inputs. The way the displacement vector will change is by changing the young's modulus of the part that the pressure is applied to. I know I will need a loop but I do not know how to set up the code to have the analysis continually run until the displacement equals the user input. Below is the code that I have so far, it runs the analysis, then goes and tweaks the young's modulus and then comes back and runs the analysis again. I need to check the value of the displacement vector against the user input after each run and stop the run if the target is reached. I would like to adjust the young's modulus by 5 MPa each time.

Any help would be greatly appreciated.

CODE --> VB

Sub CATMain()

Dim analysisDocument1 As AnalysisDocument
Set analysisDocument1 = CATIA.ActiveDocument

Dim analysisManager1 As AnalysisManager
Set analysisManager1 = analysisDocument1.Analysis

Dim analysisModels1 As AnalysisModels
Set analysisModels1 = analysisManager1.AnalysisModels

Dim analysisModel1 As AnalysisModel
Set analysisModel1 = analysisModels1.Item(1)

Dim analysisCases1 As AnalysisCases
Set analysisCases1 = analysisModel1.AnalysisCases

Dim analysisCase1 As AnalysisCase
Set analysisCase1 = analysisCases1.Item(1)

analysisCase1.Compute

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim productDocument1 As ProductDocument
Set productDocument1 = documents1.Item("Pad_Compressibility.CATProduct")

Dim product1 As Product
Set product1 = productDocument1.Product

Set product1 = product1.ReferenceProduct

Set product1 = product1.ReferenceProduct

Set product1 = product1.ReferenceProduct

Set product1 = product1.ReferenceProduct

Set product1 = product1.ReferenceProduct

Set product1 = product1.ReferenceProduct

Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("APT_Pad_Mold_Inner (working).CATPart")

Dim part1 As Part
Set part1 = partDocument1.Part

Dim parameters1 As Parameters
Set parameters1 = part1.Parameters

Dim dimension1 As Dimension
Set dimension1 = parameters1.Item("Pad Modulus")

dimension1.Value = 1000000000#

analysisCase1.Compute

End Sub 

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