Message 1 of 4
Text Along Line

Not applicable
04-22-2019
11:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Using the following code trying to place textnote along pipe curve but results are not correct as the textnote doesn't rotates along the line. This I am doing in 3D view. I am creating a ModelLine using the pipe's curve and then creating textnote which should follow the ModelLine.
// get the curve of the element Curve curve = ((LocationCurve)elem.Location).Curve; // get start and end point of pipe XYZ PipeEnd = curve.GetEndPoint(1); XYZ PipeStart = curve.GetEndPoint(0); // get vector representing the pipe double difX = (PipeEnd.X - PipeStart.X); double difY = (PipeEnd.Y - PipeStart.Y); XYZ baseVec = new XYZ(difX,difY, 0); Double textRad = Math.Atan2(baseVec.Y, baseVec.X); var testOptions = new TextNoteOptions() { HorizontalAlignment = HorizontalTextAlignment.Center, Rotation = textRad, TypeId = (doc.GetElement(texttypeID) as TextNoteType).Id }; var text = TextNote.Create(doc, view.Id, origin,strText, testOptions);
Thanks & Regards
Sanjay Pandey