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: 

GeneralSegmentLabel.Create() fails on Closed polyline

7 REPLIES 7
Reply
Message 1 of 8
Jeff_M
520 Views, 7 Replies

GeneralSegmentLabel.Create() fails on Closed polyline

This code works on a non-closed polyline:

  Curve curve = objId.GetObject(OpenMode.ForRead) as Curve;
double ratio = 0.5; if (curve != null) for (int i = 0; i < curve.EndParam; i++) GeneralSegmentLabel.Create(objId, i + ratio, lineLabelStyleObjId, curveLabelStyleObjId);

 However, it fails with the exception "The ratio should be in the range [0, 0]." on closed polylines. I can't think of any 'good' workarounds for this.

Jeff_M, also a frequent Swamper
EESignature
7 REPLIES 7
Message 2 of 8
christopher
in reply to: Jeff_M

On all of the param values, or the first or last ones?

Message 3 of 8
tyronebk
in reply to: christopher

It happens on all parameters. I can replicate the problem on a different routine that calls the same method.
Message 4 of 8

Well it looks like it's time to write a business case to get a Feature Request to fix this issue.

 

Well the first business case is Autodesk's reputation. If bugs continue to be called "Feature Requests" and require a business justification in order to get fixed, I'll continue to tell stories to who ever will listen that Autodesk doesn't stand behind their API and give examples exactly like this one. In addition time is of the essance. If it takes forever to get bugs fixed, and three plus months is too long, I'll continue to regail stories of API bugs found months and even years ago that haven't been fixed. Especially when I have to tell my customers, and Autodesk's, that I can't program something because Autodesk doesn't want to fix, or add to, the API. For number of users this will effect I'm sure Jeff, Tyronebk, and myself have a need to be able to add labels to closed features. I'm sure all of the routines will be utlized by nearly all users of the software since the products can be added to the App Store and I'm sure our Apps will sell like hotcakes.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 5 of 8

Thank you all for bring up this issue, I've reported it to development for investigation and evalutation, thank you for your understanding.



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 6 of 8
jason
in reply to: Daniel.Du

I am running into this same issue.  Anyone know if there is a fix coming?

Message 7 of 8
Daniel.Du
in reply to: jason

It has been reported to development team, unfortunately I do not have the information when it will be addressed. Sorry about that.



Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 8 of 8
brianchapmandesign
in reply to: Jeff_M

😕 I didn't have this problem.

 

                                        ObjectId id = new ObjectId();
                                        id = GeneralSegmentLabel.Create(polyline2.ObjectId, 0.0, linelabelstyle, curvelabelstyle);
                                        GeneralSegmentLabel mylbl = transaction.GetObject(id, OpenMode.ForWrite) as GeneralSegmentLabel;
                                        mylbl.LabelLocation = new Point3d(pointd3.X, pointd3.Y, 0.0);

 

 

I defined the label location and seems to work fine.

 

....awe...wait nm... I saw your code and saw you're looking to grab a specific point.  Haven't tried that myself.

 


"Very funny, Scotty. Now beam down my clothes.

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report