×
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

Formula help needed

Formula help needed

Formula help needed

(OP)
What I have is an angle that needs to be <10° and it's driven by another dimension. What I want is for the driving dimension to grow by 100mm until the angle drops under 10°. I tried a nested IF statement, but that didn't work.

This is what I tried to use, unsuccessfully: =if("Bridge Angle@Driving Sketch">10, 450, If("Bridge Angle@Driving Sketch">10,550,If("Bridge Angle@Driving Sketch">10, 650,304.8)))
It changed the driving dimension to 450 and stayed there even though the angle remained <10°.

Any thoughts?

Jeff Mirisola, CSWE
My Blog

RE: Formula help needed

Assuming that your driving dimension is named "Bridge Distance@Driving Sketch", try the following:

=if("Bridge Angle@Driving Sketch">10, "Bridge Distance@Driving Sketch" + 100, "Bridge Distance@Driving Sketch")

This should add 100 each rebuild until the angle is <= 10.

What you have is equivalent to:

CODE

If ("Bridge Angle@Driving Sketch">10) Then
  "Bridge Distance@Driving Sketch" = 450
Else
  If ("Bridge Angle@Driving Sketch">10) Then
    "Bridge Distance@Driving Sketch" = 550
  Else
    If ("Bridge Angle@Driving Sketch">10) Then
      "Bridge Distance@Driving Sketch" = 650
    Else
      "Bridge Distance@Driving Sketch" = 304.8
    End If
  End If
End If 

So when the angle is greater than 10, the distance would get set to 450, and none of the other if conditions would be evaluated. If the angle was less than 10, all of the if conditions would fail and the distancewould be set to 304.8.

RE: Formula help needed

(OP)
I forgot to mention a variable. In the end, this is going to be driven by DriveWorksXpress so multiple rebuilds isn't a possibility that I know of. However, I'm wondering if I can't embed a macro into DWX...

Jeff Mirisola, CSWE
My Blog

RE: Formula help needed

Post a schematic of what you're doing. There likely is a better solution.

RE: Formula help needed

(OP)
Ok, I'll try to explain this as best I can.
In the attached picture, everything that is named corresponds to a field in DriveWorksXpress that we'll fill out per a data sheet our customer fills out. On the middle-bottom right, just above the 'Castable' dimension is the driving dimension (Σ500)I've been talking about. The angle that I'm trying to control, the one that needs to be =<10.2°, currently shows 10.91°. I still need to apply more controls to some of the other dimensions, but if I can't get past this current hurdle, the rest won't matter anyway.
I'm going to auto-running a macro (from EEnd) via an equation, something I didn't know you could do, and see how that goes.

Jeff Mirisola, CSWE
My Blog

RE: Formula help needed

(OP)
EEnd,
I get a compile error when I try to run the macro. I changed the bridge distance reference to the dim's actual name, but don't believe I caused any other changes. Thoughts?

CODE -->

Sub main()
If ("Bridge Angle@Driving Sketch" > 10) Then
  "FromCastable@Driving Sketch" = 450
Else
  If ("Bridge Angle@Driving Sketch" > 10) Then
    "FromCastable@Driving Sketch" = 550
  Else
    If ("Bridge Angle@Driving Sketch" > 10) Then
      "FromCastable@Driving Sketch" = 650
    Else
      "FromCastable@Driving Sketch" = 304.8
    End If
  End If
End If
Set swApp = Application.SldWorks
End Sub 

Jeff Mirisola, CSWE
My Blog

RE: Formula help needed

I seem to have caused some confusion. The code block that I wrote was an my attempt to explain why your initial attempt:

CODE

=if("Bridge Angle@Driving Sketch">10, 450, If("Bridge Angle@Driving Sketch">10,550,If("Bridge Angle@Driving Sketch">10, 650,304.8))) 

would not give the result that you desired. It was not intended as something that would work.

Eric

RE: Formula help needed

(OP)
Ah, my bad. Just goes to show my extensive knowledge of coding.

Jeff Mirisola, CSWE
My Blog

RE: Formula help needed

I have not used DriveWorks, so I do not know if this would work, but here's what I would try next.
  1. Create a construction line from corner that the 10.91 dimension is attached to down to the construction line that the Σ500 dimension is on.
  2. Add an angular dimension so that it is at 10.2 degrees.
  3. Create a driven dimension that would be what Σ500 would be if you did not have to have the length be 450 + n*100. Call it FromCastableRaw.
  4. The equation for Σ500 would then be =ceiling(("FromCastableRaw@Driving Sketch" - 450) / 100, 1) * 100 + 450.
Eric

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