AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Contributor
zzffxx
Posts: 15
Registered: ‎07-27-2012
Message 1 of 12 (7,297 Views)
Accepted Solution

ImportSubassembly API for custom subassembly, error?

7297 Views, 11 Replies
11-12-2013 01:32 AM

Hi,

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("TestSubassembly", atcFile, itemId, this.doc.Editor.GetPoint("Select import subAssembly location").Value);

 

However, it is OK if to import subassembly provided by Cilvil 3D.

why? Thanks if someone could help me.

Hi,

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.

Regards,
Apple

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 2 of 12 (7,278 Views)

Re: ImportSubassembly API for custom subassembly, error?

11-12-2013 11:11 PM in reply to: zzffxx

Hi,

 

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,

Partha Sarkar

Autodesk



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Contributor
zzffxx
Posts: 15
Registered: ‎07-27-2012
Message 3 of 12 (7,266 Views)

Re: ImportSubassembly API for custom subassembly, error?

11-13-2013 09:09 PM in reply to: Partha.Sarkar

Dear Sarkar:

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:

 

Case1:

First, I import my custom subassembly using ImportSubAssembly API from atc file in the "channel001" folder(see figure1). The "eFilerError" Exception is reported.

 

Case2:

Second, I directly import my custom subassembly using Civil3D UI tools, no problem happens.

 

Case3:

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.

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 4 of 12 (7,253 Views)

Re: ImportSubassembly API for custom subassembly, error?

11-14-2013 09:56 PM in reply to: zzffxx

I will look into this and get back to you soon.

 

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

New Member
AppleGao
Posts: 2
Registered: ‎11-29-2013
Message 5 of 12 (7,208 Views)

Re: ImportSubassembly API for custom subassembly, error?

11-29-2013 01:50 AM in reply to: zzffxx

Hi,

 

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
extends [mscorlib]System.Object
{
} // end of class Subassembly.channel001

And I think it should be public rather than private, for example:

.class public auto ansi Subassembly.BasicBarrier
extends Subassembly.SATemplate
{
} // 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.

 

Regards,

Apple

 

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 6 of 12 (7,205 Views)

Re: ImportSubassembly API for custom subassembly, error?

11-29-2013 02:00 AM in reply to: AppleGao

Hi zzffxx,

 

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.

 

Thanks,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Contributor
zzffxx
Posts: 15
Registered: ‎07-27-2012
Message 7 of 12 (7,185 Views)

Re: ImportSubassembly API for custom subassembly, error?

12-02-2013 11:41 PM in reply to: zzffxx

Hi,

AppleGao,

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.

 

thanks.

 

 

New Member
AppleGao
Posts: 2
Registered: ‎11-29-2013
Message 8 of 12 (7,138 Views)

Re: ImportSubassembly API for custom subassembly, error?

12-10-2013 07:03 PM in reply to: zzffxx

Hi,

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.

Regards,
Apple

ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 9 of 12 (7,132 Views)

Re: ImportSubassembly API for custom subassembly, error?

12-11-2013 01:18 AM in reply to: AppleGao

Thanks for the confirmation Apple !

 

Cheers,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Contributor
zzffxx
Posts: 15
Registered: ‎07-27-2012
Message 10 of 12 (7,107 Views)

Re: ImportSubassembly API for custom subassembly, error?

12-13-2013 01:09 AM in reply to: AppleGao
Hi,
Apple.
Now I see. Thank for your jobs.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.