Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Exception thrown when trying to set targets for baseline region

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
285 Views, 2 Replies

Exception thrown when trying to set targets for baseline region

Hi all,

 

I have got an exception "The SubassemblyTargetInfoCollection is not got from the BaselineRegion." while trying to set targets for a baseline region of a corridor. I searched online and found the following posts, however none of them is able to help.

 

Post I have found online:

https://forums.autodesk.com/t5/autocad-civil-3d-customization/corridor-target-assigning/td-p/4642747...

https://forums.autodesk.com/t5/autocad-civil-3d-customization/subassemblytargetinfo-targetids-error-...

https://forums.autodesk.com/t5/autocad-civil-3d-customization/set-targets-to-baseline-and-baselinere...

http://civilizeddevelopment.typepad.com/civilized-development/2013/05/subassembly-targets-having-fun...

 

My goal: to set a subassembly(LaneSuperelevationAOR)'s offset target to an alignment and elevation target to the alignment's profile

 

My code: THE EXCEPTION HAPPENS AT THE LAST LINE OF THE FOLLOWING CODE. THANK YOU IN ADVANCE FOR ANY HELP.

 

 // set subassembly targets
 SubassemblyTargetInfoCollection targets = centralCorridor.Baselines[0].BaselineRegions[0].GetTargets();
 foreach (SubassemblyTargetInfo target in targets)
 {
       if(target.TargetType == SubassemblyLogicalNameType.Elevation)
       {
       ObjectIdCollection ids = target.TargetIds;
       ids.Add(ProfileId);
       target.TargetIds = ids;
       }
       else if(target.TargetType == SubassemblyLogicalNameType.Offset)
       {
        ObjectIdCollection ids = target.TargetIds;
        ids.Add(AlignmentId);
        target.TargetIds = ids;
       }
       else if(target.TargetType == SubassemblyLogicalNameType.Surface)
       {

       }
   }

             centralCorridor.Baselines[0].BaselineRegions[0].SetTargets(targets);
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

If anyone could provides a workaround, that's great too! Tons of thanks!

Message 3 of 3
Anonymous
in reply to: Anonymous

I tried to commented out the for loop and still have the same exception. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report