Editing the Default.ivb

Editing the Default.ivb

Anonymous
Not applicable
341 Views
5 Replies
Message 1 of 6

Editing the Default.ivb

Anonymous
Not applicable
Hi,

I have a code that works very well when you place it in a (VBA)Module called
"Functions", but I want to place that piece of code into the Deault.ivb.

Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As Double, Arg4 As
Double) As Double
'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise Arg4.
If Arg1 < Arg2 Then
ist = Arg3
Else: ist = Arg4
End If
End Function

Problem is: it doesn't work! Do I have to do something more than just
copy-past the code in the Default.ivb?

Thanks alot,

T. Ham
Mechanical Engineer
CDS Engineering BV
0 Likes
342 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Just one addition: I use this code in parts to "drive" my dimensions.

"Hamster" wrote in message
news:53800A2B5BF3FA30F534C48102F45F86@in.WebX.maYIadrTaRb...
> Hi,
>
> I have a code that works very well when you place it in a (VBA)Module
called
> "Functions", but I want to place that piece of code into the Deault.ivb.
>
> Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As Double, Arg4
As
> Double) As Double
> 'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise Arg4.
> If Arg1 < Arg2 Then
> ist = Arg3
> Else: ist = Arg4
> End If
> End Function
>
> Problem is: it doesn't work! Do I have to do something more than just
> copy-past the code in the Default.ivb?
>
> Thanks alot,
>
> T. Ham
> Mechanical Engineer
> CDS Engineering BV
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
Functions that are called as part of a parameter expression must exist
within the document they're referenced in. This allows the document to be
self-contained with regards to being able to compute itself.

-Brian

"Hamster" wrote in message
news:91372B05A5B7161B9E88F821A8C544FC@in.WebX.maYIadrTaRb...
> Just one addition: I use this code in parts to "drive" my dimensions.
>
> "Hamster" wrote in message
> news:53800A2B5BF3FA30F534C48102F45F86@in.WebX.maYIadrTaRb...
> > Hi,
> >
> > I have a code that works very well when you place it in a (VBA)Module
> called
> > "Functions", but I want to place that piece of code into the Deault.ivb.
> >
> > Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As Double, Arg4
> As
> > Double) As Double
> > 'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise Arg4.
> > If Arg1 < Arg2 Then
> > ist = Arg3
> > Else: ist = Arg4
> > End If
> > End Function
> >
> > Problem is: it doesn't work! Do I have to do something more than just
> > copy-past the code in the Default.ivb?
> >
> > Thanks alot,
> >
> > T. Ham
> > Mechanical Engineer
> > CDS Engineering BV
> >
> >
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
So it is not possible to reference this VBA Function from the Deault.ivb?
Hmm, in that case the VBA Function has to be copied to each part/assembly if
it is going to be used.

Thanxs for the info!

"Brian Ekins (Autodesk)" wrote in message
news:B5A82E98F88B8E28E7F311F51E9BACF5@in.WebX.maYIadrTaRb...
> Functions that are called as part of a parameter expression must exist
> within the document they're referenced in. This allows the document to be
> self-contained with regards to being able to compute itself.
>
> -Brian
>
> "Hamster" wrote in message
> news:91372B05A5B7161B9E88F821A8C544FC@in.WebX.maYIadrTaRb...
> > Just one addition: I use this code in parts to "drive" my dimensions.
> >
> > "Hamster" wrote in message
> > news:53800A2B5BF3FA30F534C48102F45F86@in.WebX.maYIadrTaRb...
> > > Hi,
> > >
> > > I have a code that works very well when you place it in a (VBA)Module
> > called
> > > "Functions", but I want to place that piece of code into the
Deault.ivb.
> > >
> > > Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As Double,
Arg4
> > As
> > > Double) As Double
> > > 'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise
Arg4.
> > > If Arg1 < Arg2 Then
> > > ist = Arg3
> > > Else: ist = Arg4
> > > End If
> > > End Function
> > >
> > > Problem is: it doesn't work! Do I have to do something more than just
> > > copy-past the code in the Default.ivb?
> > >
> > > Thanks alot,
> > >
> > > T. Ham
> > > Mechanical Engineer
> > > CDS Engineering BV
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Or placed in the part template file so when you create a new part file it's
already in the document's function node.

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Hamster" wrote in message
news:7A4C04A063B987A4D88A12CE4EF0F991@in.WebX.maYIadrTaRb...
> So it is not possible to reference this VBA Function from the Deault.ivb?
> Hmm, in that case the VBA Function has to be copied to each part/assembly
if
> it is going to be used.
>
> Thanxs for the info!
>
> "Brian Ekins (Autodesk)" wrote in message
> news:B5A82E98F88B8E28E7F311F51E9BACF5@in.WebX.maYIadrTaRb...
> > Functions that are called as part of a parameter expression must exist
> > within the document they're referenced in. This allows the document to
be
> > self-contained with regards to being able to compute itself.
> >
> > -Brian
> >
> > "Hamster" wrote in message
> > news:91372B05A5B7161B9E88F821A8C544FC@in.WebX.maYIadrTaRb...
> > > Just one addition: I use this code in parts to "drive" my dimensions.
> > >
> > > "Hamster" wrote in message
> > > news:53800A2B5BF3FA30F534C48102F45F86@in.WebX.maYIadrTaRb...
> > > > Hi,
> > > >
> > > > I have a code that works very well when you place it in a
(VBA)Module
> > > called
> > > > "Functions", but I want to place that piece of code into the
> Deault.ivb.
> > > >
> > > > Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As Double,
> Arg4
> > > As
> > > > Double) As Double
> > > > 'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise
> Arg4.
> > > > If Arg1 < Arg2 Then
> > > > ist = Arg3
> > > > Else: ist = Arg4
> > > > End If
> > > > End Function
> > > >
> > > > Problem is: it doesn't work! Do I have to do something more than
just
> > > > copy-past the code in the Default.ivb?
> > > >
> > > > Thanks alot,
> > > >
> > > > T. Ham
> > > > Mechanical Engineer
> > > > CDS Engineering BV
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
Sorry for the late reply, but thanks Sean!

I will have to copy the VBA-Function code to the Part, Sheetmetal, Assembly
and WeldAssembly Document.

Thanks again.

"Sean Dotson" wrote in message
news:21A349443E41BF1CEE09C991538F9E6A@in.WebX.maYIadrTaRb...
> Or placed in the part template file so when you create a new part file
it's
> already in the document's function node.
>
> --
> Sean Dotson, PE
> http://www.sdotson.com
> Check the Inventor FAQ for most common questions
> www.sdotson.com/faq.html
> -----------------------------------------------------------------------
> "Hamster" wrote in message
> news:7A4C04A063B987A4D88A12CE4EF0F991@in.WebX.maYIadrTaRb...
> > So it is not possible to reference this VBA Function from the
Deault.ivb?
> > Hmm, in that case the VBA Function has to be copied to each
part/assembly
> if
> > it is going to be used.
> >
> > Thanxs for the info!
> >
> > "Brian Ekins (Autodesk)" wrote in message
> > news:B5A82E98F88B8E28E7F311F51E9BACF5@in.WebX.maYIadrTaRb...
> > > Functions that are called as part of a parameter expression must exist
> > > within the document they're referenced in. This allows the document
to
> be
> > > self-contained with regards to being able to compute itself.
> > >
> > > -Brian
> > >
> > > "Hamster" wrote in message
> > > news:91372B05A5B7161B9E88F821A8C544FC@in.WebX.maYIadrTaRb...
> > > > Just one addition: I use this code in parts to "drive" my
dimensions.
> > > >
> > > > "Hamster" wrote in message
> > > > news:53800A2B5BF3FA30F534C48102F45F86@in.WebX.maYIadrTaRb...
> > > > > Hi,
> > > > >
> > > > > I have a code that works very well when you place it in a
> (VBA)Module
> > > > called
> > > > > "Functions", but I want to place that piece of code into the
> > Deault.ivb.
> > > > >
> > > > > Public Function ist(Arg1 As Double, Arg2 As Double, Arg3 As
Double,
> > Arg4
> > > > As
> > > > > Double) As Double
> > > > > 'If the Arg1 is Smaller Then Arg2 the result is Arg3 otherwise
> > Arg4.
> > > > > If Arg1 < Arg2 Then
> > > > > ist = Arg3
> > > > > Else: ist = Arg4
> > > > > End If
> > > > > End Function
> > > > >
> > > > > Problem is: it doesn't work! Do I have to do something more than
> just
> > > > > copy-past the code in the Default.ivb?
> > > > >
> > > > > Thanks alot,
> > > > >
> > > > > T. Ham
> > > > > Mechanical Engineer
> > > > > CDS Engineering BV
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes