Is there an easy way to copy a design (layout) profile? Or does one have to go through the PVIs or Entities collection and recreate it?
Solved! Go to Solution.
Solved by tyronebk. Go to Solution.
Can you use this build in function: https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/Civi...
Or do you mean copy by code?
I mean by code.
The Clone() method (inherited from RXObject) seems to create an exact copy of the profile under the same master alignment without duplicating anything unwanted from what I can see.
You also need to add the profile to the Database, like you would any AutoCAD object that is cloned, and also change the name of the profile (Civil 3D doesn't throw any errors, but this breaks the pattern).
I don't think I'm going to use this method since I feel it might lead to some broken stuff later on.
Sorry @Jeff_M, as Chris mentions, you need to change the name and add it to modelspace after cloning.
@Civil3DReminders_com I've used the Clone() method on a number of C3D objects and never had any ongoing issues. That said, there is the potential for issues when a parent object is cloned, as the children sometimes become confused about the parent object.
The case where this has proven to be the most challenging is cloning a corridor with a surface attached, the surface somehow belongs to both corridors (luckily it can be removed from one of the corridors and remain attached to the other one).
In my test drawing, I've attached reference labels, projection objects, offset profile, and corridors to the profile prior to cloning and haven't run into any issues with the children becoming confused. As far as I can tell, it behaves exactly like a profile created using the AutoCAD COPY command and I've never run into an issue using that approach but YMMV.
Can't find what you're looking for? Ask the community or share your knowledge.