<?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 Create Associative Dimensions with .NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13664223#M85201</link>
    <description>&lt;P&gt;10 years have passed since the last question asked about this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there any news about it?&lt;BR /&gt;I can create dimensions via .NET, in short, like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;AlignedDimension dimension = new AlignedDimension();&amp;nbsp; &amp;nbsp;&amp;nbsp;
//set properties&amp;nbsp; ... 
//...
//... end set properties &amp;nbsp; &amp;nbsp;
blockTableRecord.AppendEntity(dimension)&amp;nbsp; &amp;nbsp;
transaction.AddNewlyCreatedDBObject(dimension, true)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this dimmension associative? Say associate it to the segment of a Polyline.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Either via setting properties, creating association objects or just calling commands from the editor...&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jun 2025 19:30:15 GMT</pubDate>
    <dc:creator>danielmollerX5W2N</dc:creator>
    <dc:date>2025-06-03T19:30:15Z</dc:date>
    <item>
      <title>Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13664223#M85201</link>
      <description>&lt;P&gt;10 years have passed since the last question asked about this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there any news about it?&lt;BR /&gt;I can create dimensions via .NET, in short, like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;AlignedDimension dimension = new AlignedDimension();&amp;nbsp; &amp;nbsp;&amp;nbsp;
//set properties&amp;nbsp; ... 
//...
//... end set properties &amp;nbsp; &amp;nbsp;
blockTableRecord.AppendEntity(dimension)&amp;nbsp; &amp;nbsp;
transaction.AddNewlyCreatedDBObject(dimension, true)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this dimmension associative? Say associate it to the segment of a Polyline.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Either via setting properties, creating association objects or just calling commands from the editor...&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 19:30:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13664223#M85201</guid>
      <dc:creator>danielmollerX5W2N</dc:creator>
      <dc:date>2025-06-03T19:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13664483#M85204</link>
      <description>&lt;P&gt;You have to create a AcDbDimAssoc object. Here’s a sample in Python&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def PyRxCmd_pydimassoc():
    try:
        pt1 = Ge.Point3d(0, 0, 0)
        pt2 = Ge.Point3d(15, 0, 0)
        pt3 = Ge.Point3d(5, 5, 0)

        db = Db.curDb()
        model = Db.BlockTableRecord(db.modelSpaceId(), Db.OpenMode.kForWrite)

        line = Db.Line(pt1, pt2)
        line.setDatabaseDefaults()
        lineid = model.appendAcDbEntity(line)
        line.close()

        dim = Db.AlignedDimension(pt1, pt2, pt3)
        dim.setDatabaseDefaults()
        dimId = model.appendAcDbEntity(dim)
        dim.close()

        ref1 = Db.OsnapPointRef(pt1)
        ref1.setOsnapType(Db.OsnapType.kOsnapStart)
        ref1.setIdPath(lineid, Db.SubentType.kEdgeSubentType, 0)

        ref2 = Db.OsnapPointRef(pt2)
        ref2.setOsnapType(Db.OsnapType.kOsnapEnd)
        ref2.setIdPath(lineid, Db.SubentType.kEdgeSubentType, 0)

        dimAssoc = Db.DimAssoc()
        dimAssoc.setDimObjId(dimId)
        dimAssoc.setPointRef(Db.DimAssocPointType.kXline1Point, ref1)
        dimAssoc.setPointRef(Db.DimAssocPointType.kXline2Point, ref2)
        dimAssoc.updateDimension()

        dimAssoc.post(dimId)
        # or
        # Db.Core.postDimAssoc(dimId,dimAssoc)

    except Exception as err:
        traceback.print_exception(err)


def PyRxCmd_pydimassocread():
    try:
        res = Ed.Editor.entSel("\nPick a dim", Db.Dimension.desc())
        if res[0] != Ed.PromptStatus.eOk:
            return

        # acdbGetDimAssocId
        assocId = Db.Core.getDimAssocId(res[1])
        dimAssoc = Db.DimAssoc(assocId)

        # added dimAssoc.osnapPointRef so we don't need to cast in Python
        ref1 = dimAssoc.osnapPointRef(Db.DimAssocPointType.kXline1Point)
        ref2 = dimAssoc.osnapPointRef(Db.DimAssocPointType.kXline2Point)

        print(ref1.point(), ref2.point())

    except Exception as err:
        traceback.print_exception(err)


def PyRxCmd_pyremdimassoc():
    try:
        res = Ed.Editor.entSel("\nPick a dim", Db.Dimension.desc())
        if res[0] != Ed.PromptStatus.eOk:
            return

        # acdbGetDimAssocId
        assocId = Db.Core.getDimAssocId(res[1])
        dimAssoc = Db.DimAssoc(assocId, Db.OpenMode.ForWrite)

        dimAssoc.removeAssociativity()

    except Exception as err:
        traceback.print_exception(err)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 04 Jun 2025 00:02:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13664483#M85204</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2025-06-04T00:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13666165#M85207</link>
      <description>&lt;P&gt;This is not .NET, though. This class is not available.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 17:06:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13666165#M85207</guid>
      <dc:creator>danielmollerX5W2N</dc:creator>
      <dc:date>2025-06-04T17:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13666657#M85209</link>
      <description>&lt;P&gt;Holycow! Very sorry about that, I just assumed AcDbDimAssoc was wrapped in .NET.&lt;/P&gt;&lt;P&gt;I see AssocDependency classes, not sure if that’s related&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 22:24:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13666657#M85209</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2025-06-04T22:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13672548#M85223</link>
      <description>&lt;LI-CODE lang="general"&gt;var dim = tr.GetObject(id, OpenMode.ForWrite) as Dimension;
var dic = dim.ExtensionDictionary;
if (!dic.IsNull)
{
    var extDict = tr.GetObject(dim.ExtensionDictionary, OpenMode.ForWrite) as DBDictionary;                            
    var dimAssocId = extDict.GetAt("ACAD_DIMASSOC");
    if(extDict.Contains(dimAssocId))
    {
        extDict.Remove(dimAssocId); // remove association
    }  
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Jun 2025 10:01:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13672548#M85223</guid>
      <dc:creator>khodulieucuong</dc:creator>
      <dc:date>2025-06-09T10:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Associative Dimensions with .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13672559#M85224</link>
      <description>&lt;P&gt;&amp;nbsp;AcadApp.SetSystemVariable("DIMASSOC", 1); // associate dimension&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 10:06:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-associative-dimensions-with-net/m-p/13672559#M85224</guid>
      <dc:creator>khodulieucuong</dc:creator>
      <dc:date>2025-06-09T10:06:45Z</dc:date>
    </item>
  </channel>
</rss>

