<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: How to creat Linear Dimension in C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/12861809#M18190</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13598879"&gt;@cesar_mayorine362SG&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to measure a 3D object, i have not been able to create dimensions in the views (Front, Left...) ,all dimensions are oriented in top view.&lt;/P&gt;
&lt;P&gt;Can you help me with this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to set the &lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_Dimension_Normal" target="_blank" rel="noopener"&gt;Dimension.Norma&lt;/A&gt;l property.&lt;/P&gt;
&lt;P&gt;Vector3d.ZAxis for Top view (default)&lt;/P&gt;
&lt;P&gt;-Vector3d.YAxis for Front view&lt;/P&gt;
&lt;P&gt;-Vector3d.XAxis for Left view&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2024 07:56:45 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2024-06-26T07:56:45Z</dc:date>
    <item>
      <title>How to creat Linear Dimension in C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9815890#M18186</link>
      <description>&lt;P&gt;Hello every body,&lt;/P&gt;&lt;P&gt;I just want to make a linear dimension vertical or horizontal with 2 point.&lt;/P&gt;&lt;P&gt;I try to make command but it not work.&lt;/P&gt;&lt;P&gt;So, can any help me solve my problem?&lt;/P&gt;&lt;P&gt;My code below.&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture4.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/834320i4659245A762B5689/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture4.PNG" alt="Capture4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 17:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9815890#M18186</guid>
      <dc:creator>quangpt.tric</dc:creator>
      <dc:date>2020-10-21T17:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to creat Linear Dimension in C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9817076#M18187</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure to understand what you're trying to achieve, but you should be able to get some inspiration from the following codes.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;[CommandMethod("DHOR")]
public static void DimHorizontal()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    var db = doc.Database;
    var ed = doc.Editor;

    // get the first point
    var options = new PromptPointOptions("\nPick the first point: ");
    var result = ed.GetPoint(options);
    if (result.Status != PromptStatus.OK)
        return;
    var pt1 = result.Value;

    // get the second point (must have a different X value)
    options.Message = "\nPick the second point: ";
    options.BasePoint = pt1;
    options.UseBasePoint = true;
    while (true)
    {
        result = ed.GetPoint(options);
        if (result.Status != PromptStatus.OK)
            return;
        if (result.Value.X != pt1.X)
            break; ;
        ed.WriteMessage("\nSecond point must have different X value.");
    }
    var pt2 = result.Value;

    using (var tr = db.TransactionManager.StartTransaction())
    {
        // compute the 'dimensionLinePoint' (max Y value + the current dimstyle text height X 5
        var dimstyle = (DimStyleTableRecord)tr.GetObject(db.Dimstyle, OpenMode.ForRead);
        var pt3 = new Point3d(pt1.X, Math.Max(pt1.Y, pt2.Y) + 5 * dimstyle.Dimtxt, 0.0);

        // create a new RotatedDimension
        var cSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
        var dim = new RotatedDimension(0.0, pt1, pt2, pt3, "", db.Dimstyle);
        dim.TransformBy(ed.CurrentUserCoordinateSystem);
        cSpace.AppendEntity(dim);
        tr.AddNewlyCreatedDBObject(dim, true);
        tr.Commit();
    }
}

[CommandMethod("DVER")]
public static void DimVertical()
{
    var doc = Application.DocumentManager.MdiActiveDocument;
    var db = doc.Database;
    var ed = doc.Editor;

    // get the first point
    var options = new PromptPointOptions("\nPick the first point: ");
    var result = ed.GetPoint(options);
    if (result.Status != PromptStatus.OK)
        return;
    var pt1 = result.Value;

    // get the second point (must have a different Y value)
    options.Message = "\nPick the second point: ";
    options.BasePoint = pt1;
    options.UseBasePoint = true;
    while (true)
    {
        result = ed.GetPoint(options);
        if (result.Status != PromptStatus.OK)
            return;
        if (result.Value.Y != pt1.Y)
            break; ;
        ed.WriteMessage("\nSecond point must have different Y value.");
    }
    var pt2 = result.Value;

    using (var tr = db.TransactionManager.StartTransaction())
    {
        // compute the 'dimensionLinePoint' (max X value + the current dimstyle text height X 5
        var dimstyle = (DimStyleTableRecord)tr.GetObject(db.Dimstyle, OpenMode.ForRead);
        var pt3 = new Point3d(Math.Max(pt1.X, pt2.X) + 5 * dimstyle.Dimtxt, pt1.Y, 0.0);

        // create a new RotatedDimension
        var cSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
        var dim = new RotatedDimension(0.5 * Math.PI, pt1, pt2, pt3, "", db.Dimstyle);
        dim.TransformBy(ed.CurrentUserCoordinateSystem);
        cSpace.AppendEntity(dim);
        tr.AddNewlyCreatedDBObject(dim, true);
        tr.Commit();
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Oct 2020 06:11:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9817076#M18187</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-10-22T06:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to creat Linear Dimension in C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9817158#M18188</link>
      <description>&lt;P&gt;thank _gile.&lt;/P&gt;&lt;P&gt;Your code is perfect. That is what I want to do.&lt;/P&gt;&lt;P&gt;Thank you so much again!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 07:09:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/9817158#M18188</guid>
      <dc:creator>quangpt.tric</dc:creator>
      <dc:date>2020-10-22T07:09:10Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to creat Linear Dimension in C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/12861744#M18189</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to measure a 3D object, i have not been able to create dimensions in the views (Front, Left...) ,all dimensions are oriented in top view.&lt;/P&gt;&lt;P&gt;Can you help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 07:06:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/12861744#M18189</guid>
      <dc:creator>cesar_mayorine362SG</dc:creator>
      <dc:date>2024-06-26T07:06:53Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to creat Linear Dimension in C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/12861809#M18190</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13598879"&gt;@cesar_mayorine362SG&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to measure a 3D object, i have not been able to create dimensions in the views (Front, Left...) ,all dimensions are oriented in top view.&lt;/P&gt;
&lt;P&gt;Can you help me with this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to set the &lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_Dimension_Normal" target="_blank" rel="noopener"&gt;Dimension.Norma&lt;/A&gt;l property.&lt;/P&gt;
&lt;P&gt;Vector3d.ZAxis for Top view (default)&lt;/P&gt;
&lt;P&gt;-Vector3d.YAxis for Front view&lt;/P&gt;
&lt;P&gt;-Vector3d.XAxis for Left view&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 07:56:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-creat-linear-dimension-in-c/m-p/12861809#M18190</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-06-26T07:56:45Z</dc:date>
    </item>
  </channel>
</rss>

