How to create feature lines from objects (alignments) using the C# API

How to create feature lines from objects (alignments) using the C# API

daniel_rosell_moreno
Participant Participant
2,149 Views
8 Replies
Message 1 of 9

How to create feature lines from objects (alignments) using the C# API

daniel_rosell_moreno
Participant
Participant

Good morning, I've been trying to do this for a while now but I haven't been able to do it.
The idea is that given a list of alignments, convert each of them into a dynamic feature line.
From the interface it is very easy, in home, click "Feature line">"Create Feature Lines from Alignment".

 

I look forward to your responses and thanks in advance.

0 Likes
2,150 Views
8 Replies
Replies (8)
Message 2 of 9

hosneyalaa
Advisor
Advisor

@daniel_rosell_moreno 

HI ... TRY

1-GET Polyline FROM Alignment WITH   GetPolyline

 

2- Creates a FeatureLine from the Polyline WITH  Create(String, ObjectId)

 

3- Set an elevation to existing Feature Point FROM profile  WITH        SetPointElevation

 

4- Inserts a PI point along the FeatureLine FROM  (profile entities  WITH   Entities  ) WITH InsertPIPoint

 

 

3.jpg

Message 3 of 9

daniel_rosell_moreno
Participant
Participant

Sorry, I don't explain myself well.
What I have is an alignment, with several profiles.
What I want is to make a characteristic line using one of the profiles of said alignment.
Mention that it is very important that the new characteristic line is dynamic.
Anyway thanks for your answer.

0 Likes
Message 4 of 9

hosneyalaa
Advisor
Advisor

Hi

Can you attached example drawing and explain your idea

I am understanding you correctly 

0 Likes
Message 5 of 9

daniel_rosell_moreno
Participant
Participant

I have this alignment:
Captura de pantalla 2023-04-18 132952.png
And the steps I follow to create the characteristic line are the following:



0 Likes
Message 6 of 9

hosneyalaa
Advisor
Advisor

Try  @daniel_rosell_moreno 

Get ngl profile 

Change this line

(prof.ProfileType == ProfileType.FG)

Here's one way ... code by @Jeff_M @

 

 

// https://forums.autodesk.com/t5/civil-3d-customization/get-the-design-profile/m-p/10080874

public ObjectId GetDesignProfile(Alignment align)
        {
            var retval = ObjectId.Null;
            foreach(ObjectId id in align.GetProfileIds())
            {
                var prof = (Profile)id.Open(OpenMode.ForRead);
                if (prof.ProfileType == ProfileType.FG)
                    retval = id;
                prof.Close();
                if (retval != ObjectId.Null)
                    break;
            }
            return retval;
        }

 

 

0 Likes
Message 7 of 9

daniel_rosell_moreno
Participant
Participant

Ok thanks, I already have the profile with which I want to make the characteristic line. But my doubt is how to create the feature line

0 Likes
Message 8 of 9

hosneyalaa
Advisor
Advisor

what do you mean b characteristic line

I didn't understand you .

 

You better share some of the code

0 Likes
Message 9 of 9

daniel_rosell_moreno
Participant
Participant

I meant feature line not characteristic line

0 Likes