When I use ImportSubassembly API to import my subassembly created by Autodesk Subassembly Composer into my civil project, it reports error-"eFilerError".
the code like this:
atcFile = @"D:\9f92eaa4ef514ac982518852e1169932.atc";
itemId = "ab660722-c69d-4ade-b373-0e9f99c94e55";
SubassemblyCollection subassemblyCollection = cDoc.SubassemblyCollection;
ObjectId subassemblyId = subassemblyCollection.ImportSubassembly("TestSubas
However, it is OK if to import subassembly provided by Cilvil 3D.
why? Thanks if someone could help me.
Solved! Go to Solution.
Two things to check here -
1. Can you use your custom subassembly using Civil 3D UI tools ?
2. Check the GUID in the itemId
Thanks for your attention.
I have checked my custom subassembly using Civil 3D UI tools and it is fine. Another, the GUID is just from atc file. So, it seems the problem is not here.
I'll describe my testing process in detail as follows:
First, I import my custom subassembly using ImportSubAssembly API from atc file in the "channel001" folder(see figure1). The "eFilerError" Exception is reported.
Second, I directly import my custom subassembly using Civil3D UI tools, no problem happens.
After using UI tools, I find Civil3D built a new folder(see figure2 ).
Compared the two figures, two new files are created. What are they?
Now, I call the ImportSubAssembly API again to import my custom subassembly from atc file in the new folder.Civil 3D reports information(see figure3. sorry, it is Chinese version):
In this case, the "eFilerError" Exception is no longer reported. But I can't get my custom subassembly data correctly yet.
The ImportSubassembly API is new API provided by Civil 2014. I appreciate that civil 3D team has released so useful API.
Finally, I expect further help about this. Thanks.
I checked your test data, and found two problems.
1.In 316c01080d0c427f91d62dd17188ead5.atc, please use "Double" instead of "double" for DataType, or else these parameters will not be added into subassembly;
2.I used your code and test data to import subassembly channel001,and it failed to use type channel001 to create an instance.
The exception message is "The type initializer for‘Subassembly.channel001’threw an exception.". I used reflector and didn't see any subassembly in 316c01080d0c427f91d62dd17188ead5.dll, please see reflectorImage.png. And I used tool IL DASM to open this dll and found:
.class private auto ansi Subassembly.channel001
} // end of class Subassembly.channel001
And I think it should be public rather than private, for example:
.class public auto ansi Subassembly.BasicBarrier
} // end of class Subassembly.BasicBarrier
But I am not sure if it's only place should be changed to public, please check other method or definition,referring to C3DStockSubassemblies.dll.
If there is still some problems, please let me know.Thanks.
One of my colleagues investigayed your customsubassembly issue and reponded here.
Please check the above details and let us know if that helps in resolving the issue you reported here.
I checked my program according to what you instruct.
You are right about the first problem. As I changed "double" into "Double", the parameters were added successfully.
But,on the second problem we had different results. I used reflector 7.0 and can see subassembly item , see figure 1.
No matter what the problems are, I must point out that the test data (contain *.atc,*.dll and so on ) is from *.pkt file which is automatically created by Autodesk Subassembly Composer tool. The problems like "double/Double" or ".class private/public" are completely out of my control because it has existed since created by Autodesk Subassembly Composer tool.
How could I modify a dll file?
I think ImportAssembly/ImportSubAssembly APIs should provide seamless connection with Subassembly Composer tool.
I discussed the problem with the developer who exposed this API. And this API is not for importing subassembly from file atc and dll.
It is just for adding subassembly to drawing when subassembly is already imported. It's action is like dragging subassembly from tool palette to a drawing in UI.
I think the name for this API is not so appropriate, which will lead misunderstanding easily. We should have named it like AddSubassemblyToDrawing. And sorry for any inconvenient.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.