Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic string

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ryanrileywelding
2518 Views, 3 Replies

iLogic string

Hello,

 

I previously posted this in the general section, but was refered here, so sorry for the double post.

 

http://forums.autodesk.com/t5/Inventor-General/Folder-Name-for-dwg/m-p/4771057/highlight/false#M4953...

 

---

 

I'm looking for a way to reference a folder name that contains my part / assembly.  I want to use that folder name in the title block of my drawing.

 

For Example:

 

server\drawings\customer 1\machineA\replacement part01.ipt

server\drawings\customer 2\machine04\replacement assembly.iam

 

I want to be able to 'extract' the customer 1 or customer 2 name from the file path.

 

 

I've searched around for awhile now, but I can't find a solution.

 

I'm new to using iLogic and coding, but I've stumbled through this bit of code:

 

'My Ilogic

Dim Flp As String
'Set Flp to file path
Flp = ThisDoc.Path
'set iproperties for Company---
iProperties.Value("Summary", "Company")= Flp

 

It gets the file path and sets that equal to the iProperty-Company.  Is there some way I can only take part of the filename string? 

 

Thanks for your help,

 

-Ryan

 

 

Inventor Pro 2018
Windows 7 64bit
Xeon 3.00GHz 16GB
AMD FirePro W5000

3 REPLIES 3
Message 2 of 4

"server\drawings\customer 1\machineA\replacement part01.ipt"

 

You can do something like.

 

Flpath=(Mid(ThisDoc.WorkspacePath(),16))

Flpdir="\"

Folderpos=InStr(Flpath, Flpdir)

oFolder=Folderpos-1

Flp=(Left(Flpath,oFolder))

 The first line should get rid of the "server\drawings\" Then you can find the position of the next "\". then use that to get the customer only.

 

Message 3 of 4

Dim Flp As String
Dim Flpdir As String
'Set Flp To file path
Flp = ThisDoc.Path

'removes server name and drawings directory
Flpath=(Mid(Flp,13))
'Flpath=(Mid(ThisDoc.WorkspacePath(),16))

Flpdir="\"

Folderpos=InStr(Flpath, Flpdir)

oFolder=Folderpos-1
'original:  oFolder=Folderpos-1

Flp=(Left(Flpath,oFolder))

'set iproperties for Company---
iProperties.Value("Summary", "Company")= Flp

iLogicVb.UpdateWhenDone = True

 I had to modify it a bit because I kept getting the error that length couldn't equal zero.  I think it was because I said that my structure was:

server\drawings\customer 1 when it's really Z:\drawings\customer1\...

 

 

Thank you

Inventor Pro 2018
Windows 7 64bit
Xeon 3.00GHz 16GB
AMD FirePro W5000

Message 4 of 4

Sure that path difference would cause that issue.  If this is working for you great.  Your using "Flp = ThisDoc.Path" I would think ThisDoc.WorkspacePath would give a better result. 

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

Post to forums  

Autodesk Design & Make Report