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: 

ad project to i properties

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Tiesvh
251 Views, 8 Replies

ad project to i properties

Hi, I'm having some trouble adding my current project to the i properties, I often get stp from customers. files supplied, the i properties block is completely empty. I always create a project and would like to see the project number I am working in in my i properties, is something automatically possible? I already looked at i logic, but I didn't see anything about the current project or the like.

thanks in advance!
Ties v. Heugten

8 REPLIES 8
Message 2 of 9
blandb
in reply to: Tiesvh

Just to clarify, are you wanting to have your project file name automatically be applied to the project iproperty upon importing a step file? 

Autodesk Certified Professional
Message 3 of 9
Tiesvh
in reply to: blandb

Hi,
Yes thats what i want.
Message 4 of 9
jtylerbc
in reply to: Tiesvh

Yes, that's possible.  I have a rule that does that.  This puts the project file's name (without the .ipj extension) into the "Project" iProperty of a drawing.  I don't think anything would need to change for it to work in an assembly or part file, but it has never been tested that way.

 

Dim IPJ as String
Dim IPJ_Name As String
Dim IPJ_Path As String
Dim FNamePos As Long
'set a reference to the FileLocations object. 
IPJ = ThisApplication.FileLocations.FileLocationsFile
'get the location of the last backslash seperator 
FNamePos = InStrRev(IPJ, "\", -1)     
'get the project file name with the file extension
IPJ_Name = Right(IPJ, Len(IPJ) - FNamePos) 
'get the project name (without extension)
IPJ_ShortName = Left(IPJ_Name, Len(IPJ_Name) - 4)
'get the path of the folder containing the project file
IPJ_Folder_Location = Left(IPJ, Len(IPJ) - Len(IPJ_Name))

'Converts the project file name to UPPER CASE
IPJ_Shortname = UCase(IPJ_Shortname)

iProperties.Value("Project", "Project") = IPJ_Shortname

iLogicVb.UpdateWhenDone = True

 

Message 5 of 9
Tiesvh
in reply to: jtylerbc

Hi,
I get a message that it is not working:
Error in rule: project rule, in document: Q-2023110-4005.ipt

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Any idea?
Message 6 of 9
jtylerbc
in reply to: Tiesvh

As I mentioned in my previous message, I've never used it in a part file before.  But I just tried it, and it worked fine for me, with no changes to the code.  Not sure why it would behave differently for you.

Message 7 of 9
blandb
in reply to: jtylerbc

worked for me on both ipt and iam.. I just pasted the code into an empty file of each and all was fine.

Autodesk Certified Professional
Message 8 of 9
Tiesvh
in reply to: jtylerbc

hi,

 

my bad, i tested it again on other files and it worked perfect thanks!

i closed the parts where i tested it on first and when i reopend it it worked fine

Message 9 of 9
jtylerbc
in reply to: Tiesvh

Forgot to mention this earlier, but you'll want to set an Event Trigger for that rule.

 

The way I typically use it is with just the "New Document" trigger.  That's because sometimes our project file names are rather long, or there may be multiple "sub-projects" where we want that field on the drawing worded slightly differently, but are working under the same project file.  For those reasons, we only want this rule to be triggered at initial file creation, and after that the user can edit the "Project" property manually without the rule overwriting the edits.  

 

If your project file names are a bit more consistent, you may want to use something like "Before Save" instead, so it will check the project file name every time.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report