Create Survey Figure Style C#

Create Survey Figure Style C#

Anonymous
Not applicable
1,352 Views
12 Replies
Message 1 of 13

Create Survey Figure Style C#

Anonymous
Not applicable

Hello,

 

I would like to know how to create a Survey Figure Style and Survey Figure Label Style using C#. I have the following code generated and it creates the Figure Style but during the creation process I want to be able to set the Draw lot line figures in plan option under 3D Geometry. I have searched high and low for a example but I can't find one. Can someone please guide me in the right direction.

 

Thanks,

Gerald Piotrowski

 

            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            civDoc = CivilApplication.ActiveDocument;

            ObjectId surveyFigureId;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                surveyFigureId = civDoc.Styles.SurveyFigureStyles.Add("New Figure Style");

                SurveyFigureStyle surveyFigureStyle = surveyFigureId.GetObject(OpenMode.ForWrite) as SurveyFigureStyle;

                surveyFigureStyle.CreateBy = "C# Application";

                surveyFigureStyle.NetworkDisplayMode = SurveyElevationDisplayType.UseElevation;

                DisplayStyle figureDisplayStyle = surveyFigureStyle.GetDisplayStylePlan(SurveyFigureDisplayType.FigureLines);
                
                figureDisplayStyle.Visible = true;               

                if (LayerExists("A-BLDG"))
                {
                    figureDisplayStyle.Layer = "A-BLDG";
                }
                else
                {
                    CreateLayer("");

                    figureDisplayStyle.Layer = "A-BLDG";
                }

                trans.Commit();
                trans.Dispose();
            }

 

0 Likes
Accepted solutions (1)
1,353 Views
12 Replies
Replies (12)
Message 2 of 13

Jeff_M
Consultant
Consultant

It appears that this Property has not yet been exposed in the API.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 13

Anonymous
Not applicable

Jeff,

 

Which property is not yet exposed? The lot line or the Feature Label Style?

 

Thanks,

Gerald Piotrowski

0 Likes
Message 4 of 13

Jeff_M
Consultant
Consultant
The lot line...I didn't realize there was a question about the label style, sorry. Lookig through the 2014 API, I can see an entry for the FigureLabelStyles collection, but nothing for the FigureLabelStyle object. So I guess my response was actually correct for both.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 5 of 13

Anonymous
Not applicable

Hi Guys,

 

API exposed property lists of SurveyFigureStyle  are available in the link below -

 

http://docs.autodesk.com/CIV3D/2014/ENU/API_Reference_Guide/html/3f0f6d4b-4276-c9b9-5d47-343cb24418e...

 

I don't see it has "Draw lot line figures in plan" exposed yet. I can log a wish list for the same. Which is the other one ? Can you take a screenshot from the UI dialog and upload here for better understanding of it ?

 

Thanks,

 

0 Likes
Message 6 of 13

Jeff_M
Consultant
Consultant

Partha, These are the Figure Label Styles in the UI (which did not exist until C3D2013). We can access the Collections of these in the API but I don't se anything for the styles themselves.

 

3-13-2014 5-56-20 AM.png

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 7 of 13

Anonymous
Not applicable

Jeff -

 

In 2014 I see Survey Figure Label styles are exposed. Did you check LabelStylesSurveyRoot ?

 

Surver_Label_Style.png

 

 

I think this what you are looking for here.

Let me know -

 

Thanks,

Partha

0 Likes
Message 8 of 13

Jeff_M
Consultant
Consultant

Yes, Partha, I noted we could get the collections. However,...oh crud. Being dense today and not thinking straight. Just use the Add(name) method of the desired collection, which returns the new ObjectId. Get the object then edit the new Style to suit.

 

            CivilDocument civdoc = CivilApplication.ActiveDocument;
            using (AcDb.Transaction tr = AcDb.HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
            {
                LabelStyleCollection styles = civdoc.Styles.LabelStyles.GetSurveyLabelStyles().FigureLabelStyles;
                styles.Add("NewStyleTest");
                tr.Commit();
            }

 

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 9 of 13

Anonymous
Not applicable
Im sorry I forgot to mention that I am using C3D 2013. And I did look in the "AutoCAD_Civil_3D_API_Developer_s_Guide.pdf" and seen that the only sample code for Survey was under the Legacy COM API.

I assume that that has changed for the 2014 version?

Thanks,
Gerald Piotrowski
0 Likes
Message 10 of 13

Jeff_M
Consultant
Consultant
What I showed is also available in 2013. Forget the Developer's Guide, it hasn't been updated in a while (I actually haven't looked at it in ~ 4 years...). Look at the API Reference and you will find these listed. Try the code I posted, it should work for you.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 11 of 13

Jeff_M
Consultant
Consultant
Accepted solution

Verified, works in C3D2013:

 

3-13-2014 2-23-03 PM.png

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 12 of 13

Anonymous
Not applicable

Thanks for checking this in 2013 release Jeff !

 

Cheers,

Partha

0 Likes
Message 13 of 13

Anonymous
Not applicable

Thanks for the help. I will give it a try when I have a free moment.

 

Gerald Piotrowski

0 Likes