Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Formula help needed 1

Status
Not open for further replies.

JMirisola

Mechanical
Sep 28, 2006
2,357
0
0
US
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
 
Replies continue below

Recommended for you

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.
 
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
 
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
 
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
 
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
 
I have not used DriveWorks, so I do not know if this would work, but here's what I would try next.
[ol][li]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.[/li]
[li]Add an angular dimension so that it is at 10.2 degrees.[/li]
[li]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.[/li]
[li]The equation for Σ500 would then be =ceiling(("FromCastableRaw@Driving Sketch" - 450) / 100, 1) * 100 + 450.[/li][/ol]

Eric

 
Status
Not open for further replies.
Back
Top