Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - Last update with (Inventor Version)

8 REPLIES 8
Reply
Message 1 of 9
douthett
785 Views, 8 Replies

iLogic - Last update with (Inventor Version)

I'm trying to figure out how to create an  iLogic rule that would create a Custom iProperties and put in what version of Inventor the file was last udpated with.

 

Does anyone have an idea how I would do this?   I'm just learning iLogic so the answer is probably staring me in the face

8 REPLIES 8
Message 2 of 9
yannicknielsen
in reply to: douthett

Dim Volume123 As String

Volume123 = Round(iProperties.Volume/100^3, 3)& " L"

iProperties.Value("Custom", "MyVolume") = Volume123

Dim Mass123 As String

Mass123 = Round(iProperties.Mass, 3) & " KG"
iProperties.Value("Custom", "MyMass") = Mass123

 

I am learning iLogics myself. I don't know how to extract the version number - But as you may be able to see from this, you can write iProperties.Value("Custom", "YourName") = whatever parameter you insert the version number into

 

That creates a custom iProperty with the name you gave it ("YourName").

 

I can't figure out how to call the inventor build.. But I imagine it's ThisApplication.Something, at least..

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 3 of 9
pcrawley
in reply to: yannicknielsen

I think the line you almost had was:

 

oBuild = ThisApplication.SoftwareVersion.DisplayName()
MessageBox.Show(oBuild)

 

This will work on its own and just report the version, service pack level and build number.

 

There are other variables you can use:

 

  • BetaVersion Gets the Beta version. If this is not a Beta version software, this value will be zero. 
  • BuildIdentifier Gets the number that completely identifies a particular build of Autodesk Inventor. 
  • DisplayName Gets the human-readable, displayable name designating this particular version (e.g.: 'Autodesk Inventor (tm) Release 2.5 Service Pack 3'). (This is the one I used in case you are looking for syntax)
  • DisplayVersion Returns the release version displayed to users. (e.g.: '2009' for Major version 13 or '2010' for Major version 14) 
  • Is64BitVersion Always false in 32-bit Inventor. Use this property to find out whether your code is connected to a 64-bit version of Inventor. 
  • IsEducationVersion Returns whether this is an educational versions of Inventor. 
  • Major Gets the Major release number (e.g.: Release '1', '2', ...). 
  • Minor Gets the Minor release number. If none, a zero is returned. (e.g.: the '5' in release 1.5). 
  • NotProduction Gets a Boolean flag indicating whether this software is intended for purely internal purposes or not. Beta is considered external. 
  • ProductEdition Gets the product edition. Only valid when SoftwareVersion is obtained from the Application. 
  • ProductName Gets the product name. Only valid when SoftwareVersion is obtained from the Application. 
  • ServicePack Gets the number of the Service Pack if this software has been updated with such. If none, a zero is returned. (e.g.: the '3' in Release 2.5 Service Pack 3).

Introduced in Inventor 4

Peter
Message 4 of 9
yannicknielsen
in reply to: pcrawley

Dim VersionNumber As String

VersionNumber =ThisApplication.SoftwareVersion.DisplayName()


iProperties.Value("Custom", "Version") = VersionNumber

 So this would be the code to put it into an iProperty?

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 5 of 9
pcrawley
in reply to: douthett

You don't need the first line (in iLogic).

You run the rest of your code and it creates the iProperty with the required version in it.
Peter
Message 6 of 9
yannicknielsen
in reply to: pcrawley

Aha!

 

So I don't need to define it as a string in the mass and volume code either?

 

Is it automatically considered a string when put into an iProperty, or?

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 7 of 9
pcrawley
in reply to: douthett

Correct. In iLogic, you typically don't need to declare a variable type ahead of the variable itself. I'm no programmer, but variables in iLogic are created as a "nothing" type until you give them a value.

So a line of iLogic that reads:

componentMass =

Creates a variable that has no type. It could be a Boolean, a string, a number... It only takes on a "type" when you add the rest of the line:

componentMass = "50kg"

This is now a string.

componentMass = True

Would make it a Boolean etc.

Hope this helps!
Peter
Message 8 of 9
yannicknielsen
in reply to: pcrawley

I see!

 

Awesome - I have a lot to learn, but I'm slowly getting there, looking at people's codes 😄

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 9 of 9
pcrawley
in reply to: douthett

You're well on the way. But be careful - iLogic is addictive!

Check out this: http://inventortrenches.blogspot.co.nz/?m=1

I learnt so much from this site.
Have fun!
Peter

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report