Get ObjectID of the subassembly from which a 3D Solid was extracted from

jhdempsey
Advocate
Advocate

Get ObjectID of the subassembly from which a 3D Solid was extracted from

jhdempsey
Advocate
Advocate

Hi All

 

Does anyone know if there is an easy way to identify what subassembly a 3D solid has been generated from (assuming that solid was produced by extracting solids from a Civil 3D corridor)

The property sets put on the objects automatically from 2017 onwards state the assembly it came from, but not the subassembly.

 

In the end, i want to end up with the ObjectID of the subassembly so i can start to extract its parameters and add them to a custom property set on the 3D solid

 

At the moment, im going down some very convoluted route to start trying to compare the 3D solid geometry with points im extracting from the AppliedSubassemblies. Once i can identify via the geometry which AppliedSubassemly has created that 3D solid, one of the properties of the AppliedSubassembly gives me the objectID of the subassembly which generated it.

 

I wanted to check if im missing a trick, and there isnt a dictionary or something similar i can access which would state this? Civil must have a record stored somewhere to make the dynamic solids feature work so it knows what solids to re-create?

0 Likes
Reply
1,198 Views
9 Replies
Replies (9)

moogalm
Autodesk Support
Autodesk Support

Are you seeking AutoCAD NET API to find the ObjectID from AutoCAD vanilla, i.e., Is the C3D drawing exported to AutoCAD ?

 

May be you can share a test drawing for us to understand ? Detail instructions of your workflow

 

0 Likes

jhdempsey
Advocate
Advocate

I have an assembly set up which has a lane and a safety barrier subassembly attached to each side (see screenshot below). The two safety barrier subassemblies have differing parameters. For example, the left barrier has working width and containment levels of W1 and H2 (see properties window in screenshot below), and the safety barrier subassembly on the right has settings of W2 and N2.

CalcPropHelp1.PNG

Solids have been extracted from the corridor (with dynamic solids option turned on), and the default property set containing information about the corridor has been applied (see property sets in screenshot below)

CalcPropHelp2.PNG

Assuming the user has selected one of the 3D solids that have been created from one of the safety barrier subassemblies, I need some code to work out which subassembly that solid was created from.

Once I know that, I can extract the parameters of the subassembly I want. For example, If I was to select a solid created from the left safety barrier subassembly, I would return working width and containment levels of W1 and H2. But if I selected an object created from the right subassembly, I would return values of W2 and N2

 

I have some code which works at the moment, but it seems a long way round to determine this information.

My code loops through each AppliedAssembly and its AppliedSubassemblies looking for shapes which have the same shape code as the code stated in the property set. Because there may be more than one shape within each AppliedAssembly with the specified name (I have two safety barrier subassemblies on the assembly so I would always expect there to be two shapes with the same name on each AppliedAssembly), I then compare the coordiantes of each shape to the vertices of the selected solid. If all the shape vertices exist on the 3D solid then I know I have the right AppliedSubassembly, and can then easily get the "seed" Subassembly via one of the AppliedSubassembly properties.

 

I was wondering if there was any other method I could work out the subassembly with? I was thinking there may be something sat in the background that makes the "dynamic solids" feature work as it must have some record of which shape was created by which subassembly.

 

This code will be run in the same drawing file which contains the corridor object, so this code will be running and using the Civil 3D .NET API

0 Likes

moogalm
Autodesk Support
Autodesk Support

Sorry! your post  contains a lot of c3d jargon, please post this in Civil 3D customization.

https://forums.autodesk.com/t5/civil-3d-customization/bd-p/190

0 Likes

jhdempsey
Advocate
Advocate

ops, I though I had posted it in that forum!

Are you able to move it for me, or do I have to re-post it myself?

0 Likes

gleeuwdrent
Advocate
Advocate

As far as I know, there is no method to match the corridor solids to the source data, since the Corridor Solids function is not exposed in the API. I would be very happy if they expose it...

0 Likes

moogalm
Autodesk Support
Autodesk Support

I received following suggestion from C3D team.

 

From the Solid’s property set, we can get “Side” property and “CodeName” property. And I think we can combine these two properties to figure out the original SubAssembly.

 

Let me know if this doesn't address the problem.

0 Likes

gleeuwdrent
Advocate
Advocate

That's no solution, even if we also add the subassembly name in the solids layer, we could have multiple solids with the same data, because the subasembly name and CodeName doesn't have to be unique.

 

Probably a solution is to give all your subassemblies a unique name, and place the solids on subassembly name layer. Than you can map the solids with original subassemblies.

0 Likes

gleeuwdrent
Advocate
Advocate

Addition: generate unique names for subassemblies can be done by adding the Handle value to the subassembly names. 

0 Likes

jhdempsey
Advocate
Advocate

Agreed

 

If you add two "lane" subassemblies to the left hand side of the assembly, you will have two shapes which have the same "code name" and "side" values. This is why I'm having to perform checks with the 3D solids vertices to see if the shapes coordinates match the coordiantes on the solid

0 Likes