iLogic save location

iLogic save location

Anonymous
Not applicable
1,913 Views
3 Replies
Message 1 of 4

iLogic save location

Anonymous
Not applicable

Hi all, 

 

I'm searching for some code to save my file in a library. I have some libraries defined in my project ( in the project editor under 'libraries'), and instead of giving me the directory for the workspace, with the thisdoc.workspacepath code, it should give me the directory where the libraries are located. for example:

 

workspacepath = thisdoc.workspacepath

 

Librarypath = thisprojectlibrarypath ????? (something like this) 🙂

 

thanks

 

 

0 Likes
Accepted solutions (1)
1,914 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

Again, I found the answer in about 2 minutes using API help. I suggest you check there first.

 

api HELP.JPG


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

MechMachineMan
Advisor
Advisor

For anyone else curious,

 

Query and create library paths API Sample

Sub QueryAndCreateLibraryPaths()
    Dim oProjectMgr As DesignProjectManager
    Set oProjectMgr = ThisApplication.DesignProjectManager

    ' Get the active project
    Dim oProject As DesignProject
    Set oProject = oProjectMgr.ActiveDesignProject

    Dim oLibraryPaths As ProjectPaths
    Set oLibraryPaths = oProject.LibraryPaths

    ' Add a new library path to the end of the list
    Call oLibraryPaths.Add("MyLibraryPath", "C:\temp\MyLibrary")

    ' Print all library names and paths
    Dim oLibraryPath As ProjectPath
    For Each oLibraryPath In oLibraryPaths
        Debug.Print "Name: " & oLibraryPath.Name & " Path: " & oLibraryPath.Path
    Next
End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 4 of 4

Anonymous
Not applicable
Accepted solution

The code works, but there is to much clutter in my opinion. Also it doesn't function within the Ilogic ('set' functions are not supported etc)

I was looking for something really simple, and I just found that.

 

Left(ThisDoc.WorkspacePath(),Len(ThisDoc.WorkspacePath()) - 7)

 

This gives me exactly the path I needed. The location that I wanted, was the path above the project workspace folder. Because my workspace folder is called 'designs', I can just count off the number of characters, in my case 7, from the workspace path string. Then with a 'left' function, it gets the location without the 'designs' part in it.