- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I've been working on an add-in that occasionally requires .f3d files be imported into the active document.
I've gotten this feature to work perfectly when I only have to import a singular .f3d document but gives me an error (which I will include below) whenever I try to import multiple f3d files within the same execute. I do not get an error when I only import a single file in that execution and can run the add-in as many times as I'd like in the same document.
I have been trying to isolate/solve this error for about two days. I was extremely frustrated when I could not replicate the error in a sample script, which I often do before I post a question to the forums. I eventually tried avoiding this error in so many ways that I was confident it was not something with my specific add-in that was causing the issue: this is when I copied and pasted the code into a fresh add-in (the demo add-in that automatically created through the "Scripts and Add-Ins" command when you make a new add-in.
The following snippet of code will cause an error when pasted into the onExecute section/class of an add-in, but will run fine with a script:
pathNewel = 'C:/Users/jaked/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/AStairGramF360AddIn/resources/3dData/newels/starterNewelModern Notched.f3d' #I've attached this file in my post, but you can probably replace it with any .f3d file path you happen to have.
importMgr = app.importManager
importNewel = importMgr.createFusionArchiveImportOptions(pathNewel)
importMgr.importToTarget2(importNewel,rootComp)
importMgr.importToTarget2(importNewel,rootComp) #If this line is commented out, the code runs, if not, it throws the error.
There are two possible error codes it gives when this happens. The one that I've dealt with far more commonly is the pBase error. The error code it picks seems to be random:
The no RTTI data! error can sometimes be induced by running the add-in after recently restarting f360.
I think part of my problem is that I don't know what either of these error codes mean, is there somewhere I can look up the error code meanings? I googled "F360 API pBase error" and haven't gotten any results.
A few things I've already tried to solve/workaround this are:
* re assigning all of the varibles in almost any order you can think of
* trying it with a new component
* trying it with it making a new component within the importToTarget() function
* trying to put other things in between the two imports
* trying to use different target components
* trying to use importToTarget2() for one and importToTarget() for another
* trying to use two different .f3d files
* trying a try loop within a while True loop (this was obviously a bad idea but the concept was to give the program time (this was a horrible idea))
* Putting the whole thing into a function
* putting just some parts into a function
None of those worked.
I'm excited to hear back about what the cause of this issue is and what some solutions/workarounds can be.
My use case is importing different newel posts and eventually balusters into a staircase design and requires zero to multiple offline 3D objects (newels and balusters) to be imported into a child component in the document and then manipulated afterward (to notch them/apply appearance/put them in the correct space. Sometimes the 3D objects are the same and sometimes there could be several different objects that need to be imported, none of which are the same (depending on the staircase design).
I am anticipating this to be a challenging problem and very much appreciate any help that can be offered!
If needed I can upload the sample Add-in I created, but it will probably be easier to just copy and paste the code into an existing add-in on a local machine for testing purposes.
Solved! Go to Solution.