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!

Variable Automation

Status
Not open for further replies.

THGRMA

Electrical
Mar 10, 2008
3
Hi all,

I am hoping that someone will be able to point me in the right direction with a problem I have with varibles.

What I want to do is to suppress two features if the size of a hole is over a specific size.

I have written a .bas file which contains the following:

'===========================================================================
Sub VarSelect(ByVal ip As Double, ByRef op1 As Double, ByRef op2 As Double)

If (ip >= 6) Then
op1 = 1
op2 = 1
Else
op1 = 0
op2 = 0
End If

End Sub
'===========================================================================

When I try to add the the code to into the variables table I get an error.

I tried using three variables that are just TEST, A and B so that none of the geometry was being driven and I still get the same error.

The error says:
"Variable "test" is driven and cannot be used within related geometry to evaluate driving variable "test""

It appears to be saying that the variable TEST is being driven and cannot be used but I am not trying to drive TEST I am trying to use its value to set variables A & B!!

If someone can point me in the direction of why this is happening, I would very much appreciate it.

Thanks

Kind regards
 
Replies continue below

Recommended for you

Hi,

your function must be used as formula for the suppresion
variables passed in as argument 2 or argument 3
The first argument must be the one to check against.
You need only to set it as formula for 1 suppression variable
SE will automatically set it for the other as well (that's
because the output (arg2/arg3) will name them)

Remember: your Formula does not directly return a value!

See image

dy
 
 http://files.engineering.com/getfile.aspx?folder=1e737f7a-9c80-4f64-884a-8790b1867b4b&file=Func_Bas_Appld.jpg
Found out what the problem was...

The .bas filename had a $ in it and didn't like that.

I ended up in the end typing it in by hand rather than use the wizard.

Thanks for your help, it has been much appreciated.

Kind regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor