<?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 Re: Custom grip moves but dynamic block reference doesn't in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178015#M1749</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The issue seems to be related to the block itself. You should attach it.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2024 17:03:34 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2024-11-27T17:03:34Z</dc:date>
    <item>
      <title>Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13177752#M1748</link>
      <description>&lt;P&gt;I'm inserting a dynamic block reference into drawing that has a custom grip used for moving the block.&lt;BR /&gt;By changing the value of DynamicBlockReferenceProperty position property, the grip is at the correct position after insert but the block geometry stays in place.&lt;/P&gt;&lt;P&gt;Any ideas how to fix this issue?&lt;BR /&gt;&lt;BR /&gt;Code (this snippet is inside a transaction):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            var blkRef = new BlockReference(Point3d.Origin, blkRecId);
            var currentSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
            var blkRefId = currentSpace.AppendEntity(blkRef);
            tr.AddNewlyCreatedDBObject(blkRef, true);
            if (blkRef.IsDynamicBlock)
            {
                var dynProps = blkRef.DynamicBlockReferencePropertyCollection;
                foreach (DynamicBlockReferenceProperty prop in dynProps)
                {
                    if (prop.PropertyName == "Position1 X")
                        prop.Value = 1.0;
                    if (prop.PropertyName == "Position1 Y")
                        prop.Value = 1.0;
                }
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 15:26:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13177752#M1748</guid>
      <dc:creator>OrmArTHe</dc:creator>
      <dc:date>2024-11-27T15:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178015#M1749</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The issue seems to be related to the block itself. You should attach it.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 17:03:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178015#M1749</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-11-27T17:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178036#M1750</link>
      <description>&lt;P&gt;Here it is...&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 17:11:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178036#M1750</guid>
      <dc:creator>OrmArTHe</dc:creator>
      <dc:date>2024-11-27T17:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178340#M1751</link>
      <description>&lt;P&gt;How do you do the "custom grip"? GripOverrule? If so, how is the Overrule's filter is set? I assume the Overrule targets BlockReference. Do you filter BlockReferences by BlockReference.Name?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 18:55:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178340#M1751</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-11-27T18:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178361#M1752</link>
      <description>&lt;P&gt;I've tried to use GetGripPoints and MoveGripPointsAt methods and now neither the grip nor the block geometry move...&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            if (blkRef.IsDynamicBlock)
            {
                double position1X = 0.0;
                double position1Y = 0.0;
                var dynProps = blkRef.DynamicBlockReferencePropertyCollection;
                foreach (DynamicBlockReferenceProperty prop in dynProps)
                {
                    if (prop.PropertyName == "Position1 X")
                    {
                        position1X = (double)prop.Value;
                    }
                    if (prop.PropertyName == "Position1 Y")
                    {
                        position1Y = (double)prop.Value;
                    }
                }
                // get grip points
                var gripPoints = new Point3dCollection();
                var gripPosition = new Point3d();
                gripPosition = new Point3d(gripPosition.X + position1X, gripPosition.Y + position1Y, gripPosition.Z);
                gripPoints.Add(gripPosition);
                var snapModes = new IntegerCollection();
                var geometryids = new IntegerCollection();
                blkRef.GetGripPoints(gripPoints, snapModes, geometryids);
                // move grip points
                var indices = new IntegerCollection();
                indices.Add(0);
                var offset = new Vector3d(2.0, 2.0, 0.0);
                blkRef.MoveGripPointsAt(indices, offset);
            }&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 18:59:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178361#M1752</guid>
      <dc:creator>OrmArTHe</dc:creator>
      <dc:date>2024-11-27T18:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178502#M1753</link>
      <description>&lt;P&gt;The "geometry" of your block is only attribute references.&lt;/P&gt;
&lt;P&gt;When inserting an attributed block, you have to explicitly, create the attribute references using the attribute definitions in the the block definition as templates and add them to the block reference attribute collection.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var blkRef = new BlockReference(Point3d.Origin, blkRecId);
var currentSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
var blkRefId = currentSpace.AppendEntity(blkRef);
tr.AddNewlyCreatedDBObject(blkRef, true);

// Add attribte references
var blkRec = (BlockTableRecord)tr.GetObject(blkRecId, OpenMode.ForRead);
foreach (ObjectId id in blkRec)
{
    if (id.ObjectClass.Name == "AcDbAttributeDefinition")
    {
        var attDef = (AttributeDefinition)tr.GetObject(id, OpenMode.ForRead);
        if (!attDef.Constant)
        {
            var attRef = new AttributeReference();
            attRef.SetAttributeFromBlock(attDef, blkRef.BlockTransform);
            blkRef.AttributeCollection.AppendAttribute(attRef);
            tr.AddNewlyCreatedDBObject(attRef, true);
        }
    }
}

if (blkRef.IsDynamicBlock)
{
    var dynProps = blkRef.DynamicBlockReferencePropertyCollection;
    foreach (DynamicBlockReferenceProperty prop in dynProps)
    {
        if (prop.PropertyName == "Position1 X")
            prop.Value = 1.0;
        if (prop.PropertyName == "Position1 Y")
            prop.Value = 1.0;
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Nov 2024 19:56:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178502#M1753</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-11-27T19:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Custom grip moves but dynamic block reference doesn't</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178538#M1754</link>
      <description>&lt;P&gt;Actually, I have that code block related to adding attribute references. The issue was that the code for accessing and changing the grip point position was above it, instead of below it.&lt;BR /&gt;Once again thank you,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 20:06:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-grip-moves-but-dynamic-block-reference-doesn-t/m-p/13178538#M1754</guid>
      <dc:creator>OrmArTHe</dc:creator>
      <dc:date>2024-11-27T20:06:57Z</dc:date>
    </item>
  </channel>
</rss>

