Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 67020

Re: Units system in document

$
0
0

As indicated you need to convert the coordinates from millimeters to feet first in order to get the length correctly in mm units.

 

Please find the modified code:

 

        public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elemSet)
        {
            UIApplication uiap = cmdData.Application;
            UIDocument uidoc = uiap.ActiveUIDocument;
            Document doc = uidoc.Document;


           View view = doc.ActiveView;
            XYZ startPoint = new XYZ(0, 0, 0);
            XYZ endPoint = new XYZ(UnitUtils.Convert(100, DisplayUnitType.DUT_MILLIMETERS, DisplayUnitType.DUT_DECIMAL_FEET), 0, 0);

            using (Transaction t = new Transaction(doc, "Creat Detail Line"))
            {
                t.Start();
                Line l1 = Line.CreateBound(startPoint, endPoint);
                doc.Create.NewDetailCurve(view, l1);
                t.Commit();
                TaskDialog.Show("Creat Detail Line", "Line was created");
            }

            return Result.Succeeded;
        }

If this reply satisfies your need please don't forget to mark it as an answer.


Viewing all articles
Browse latest Browse all 67020

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>