Inventor Customization

Inventor Customization

Reply
Contributor
heyjude19
Posts: 24
Registered: ‎01-01-2013
Message 1 of 4 (136 Views)
Accepted Solution

Divide a segment equally with a range in visual basic

136 Views, 3 Replies
01-15-2013 05:44 PM

How do you divide a segment equally with a range in visual basic?

 

example-

length is 144 in

range- 7.5 - 9in

answer- (18) at (range 8 in)

 

like to know how to do this in Visual Basic so I can create some rules and forms in iLogic

thx

Hi there,

 

There are loads of ways to do this. Here is one:

 

Sub Demo()
Dim Length As Double
Dim Range As Double
Length = 144
Range = 8
MsgBox (Answer(Length, Range))
End Sub
Function Answer(L As Double, R As Double)
Answer = L / R
End Function

This should be a start for you

 

Cheers

 

Jon.

Valued Contributor
jonbrabbs
Posts: 76
Registered: ‎07-26-2007
Message 2 of 4 (129 Views)

Re: Divide a segment equally with a range in visual basic

01-15-2013 11:48 PM in reply to: heyjude19

Hi there,

 

There are loads of ways to do this. Here is one:

 

Sub Demo()
Dim Length As Double
Dim Range As Double

    Length = 144
    Range = 8

    MsgBox (Answer(Length, Range))
End Sub

Function Answer(L As Double, R As Double)
    Answer = L / R
End Function

This should be a start for you

 

Cheers

 

Jon.

///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Contributor
heyjude19
Posts: 24
Registered: ‎01-01-2013
Message 3 of 4 (122 Views)

Re: Divide a segment equally with a range in visual basic

01-16-2013 04:34 AM in reply to: jonbrabbs

Thanks Jon

- can this be done within the parameters instead of iLogic?

Valued Contributor
jonbrabbs
Posts: 76
Registered: ‎07-26-2007
Message 4 of 4 (115 Views)

Re: Divide a segment equally with a range in visual basic

01-16-2013 06:55 AM in reply to: heyjude19

Yes, it's not difficult, but can be tricky and frustrating! Parameters can be pretty fickle when it comes to units.

 

If you have:

 

d0 = Length (in)

d1 = Range (in)

d2 = Answer/Segments (ul)

 

Note that the inch units cancel each other to give a unitless value (in/in = ul). 

 

Cheers

 

Jon.

 

 

///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.