<?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: Modify Dynamic Block Properties before Jig in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4296850#M49231</link>
    <description>&lt;P&gt;Hi Fenton,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like the modified block to display as modified before the jigging.&lt;/P&gt;&lt;P&gt;I've have tried modifying the blockreference within a seperate transaction and comitting it before the jig.&lt;/P&gt;&lt;P&gt;FlushGraphics doesn't seem to work.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FlushGraphics also shows &amp;nbsp;the block at the insertion point until after the jig.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;No idea why I can't get this to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2013 19:49:33 GMT</pubDate>
    <dc:creator>SRSDS</dc:creator>
    <dc:date>2013-06-12T19:49:33Z</dc:date>
    <item>
      <title>Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3945734#M49223</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to modify the properties of a dynamic block after the insert and before a jig?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried a quite a few things but here is some code as a starting point. The blocks are affected by the change but not in a good way. The blocks have several parametric constraints. I wonder if this is part of the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    &amp;lt;CommandMethod("TestEntityJigger7")&amp;gt; _
    Public Shared Sub TestEntityJigger7_Method()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim db As Database = HostApplicationServices.WorkingDatabase
        Dim pr As PromptResult = ed.GetString(vbLf &amp;amp; "Block name:")
        If pr.Status = PromptStatus.OK Then
            Using tr As Transaction = db.TransactionManager.StartTransaction()
                Dim bt As BlockTable = TryCast(tr.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
                Dim btr As BlockTableRecord = TryCast(tr.GetObject(bt(pr.StringResult), OpenMode.ForRead), BlockTableRecord)
                If btr IsNot Nothing Then
                    Dim br As New BlockReference(New Point3d(0, 0, 0), btr.ObjectId)
                    Dim pc As DynamicBlockReferencePropertyCollection = br.DynamicBlockReferencePropertyCollection
                    For i = 0 To pc.Count - 1
                        Dim prop As DynamicBlockReferenceProperty = pc(i)
                        If prop.PropertyName = "A" Then prop.Value = 1000.0#
                        If prop.PropertyName = "B" Then prop.Value = 2000.0#
                    Next
                    pc.Dispose()
                    If BlockMovingRotating.Jig(br) Then
                        Dim modelspace As BlockTableRecord = TryCast(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
                        modelspace.AppendEntity(br)
                        tr.AddNewlyCreatedDBObject(br, True)
                        tr.Commit()
                    Else
                        tr.Abort()
                    End If
                End If
            End Using
        End If
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2013 23:26:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3945734#M49223</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-06-03T23:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3947093#M49224</link>
      <description>Firstly, please remove the lines:&lt;BR /&gt;Else&lt;BR /&gt;tr.Abort()&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Jun 2013 08:23:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3947093#M49224</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2013-06-05T08:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3947149#M49225</link>
      <description>&lt;P&gt;Also try this code, not tested&lt;/P&gt;&lt;PRE&gt;        &amp;lt;CommandMethod("TestEntityJigger7")&amp;gt; _
        Public Shared Sub TestEntityJigger7_Method()
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
            Dim db As Database = HostApplicationServices.WorkingDatabase
            doc.TransactionManager.EnableGraphicsFlush(True)
            Dim pr As PromptResult = ed.GetString(vbLf &amp;amp; "Block name:")
            If pr.Status = PromptStatus.OK Then
                Using tr As Transaction = db.TransactionManager.StartTransaction()
                    Dim bt As BlockTable = TryCast(tr.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
                    Dim btr As BlockTableRecord = TryCast(tr.GetObject(bt(pr.StringResult), OpenMode.ForRead), BlockTableRecord)
                    If btr IsNot Nothing Then
                        Dim br As New BlockReference(New Point3d(0, 0, 0), btr.ObjectId)
                        Dim pc As DynamicBlockReferencePropertyCollection = br.DynamicBlockReferencePropertyCollection
                        For i = 0 To pc.Count - 1
                            Dim prop As DynamicBlockReferenceProperty = pc(i)
                            If prop.PropertyName = "A" Then prop.Value = 1000.0#
                            If prop.PropertyName = "B" Then prop.Value = 2000.0#
                        Next
                        pc.Dispose()
                        tr.TransactionManager.QueueForGraphicsFlush()
                        If BlockMovingRotating.Jig(br) Then
                            Dim modelspace As BlockTableRecord = TryCast(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
                            modelspace.AppendEntity(br)
                            tr.AddNewlyCreatedDBObject(br, True)
                            tr.TransactionManager.QueueForGraphicsFlush()
                            doc.TransactionManager.FlushGraphics()
                            tr.Commit()

                        End If
                    End If
                End Using
            End If
        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 10:08:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/3947149#M49225</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2013-06-05T10:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4294767#M49227</link>
      <description>&lt;P&gt;Hi Hallex,&lt;BR /&gt;It didn't seem to help. The dynamic grip points are not updated with the newly defined lengths.&lt;BR /&gt;And the properties palette&lt;BR /&gt;I can work around this by deleting the block reference and inserting a fresh one with the results from the jig.&lt;BR /&gt;&lt;BR /&gt;The big problem is that I can't get the block to display properly for the jig in most cases.&lt;BR /&gt;&lt;BR /&gt;Attached is an example.&lt;BR /&gt;Including a dimension change for the C parameter shows the problem.&lt;/P&gt;&lt;PRE&gt;                        If prop.PropertyName = "A" Then prop.Value = 1000.0#
                        If prop.PropertyName = "B" Then prop.Value = 2000.0#
                        If prop.PropertyName = "C" Then prop.Value = 3000.0#&lt;/PRE&gt;&lt;P&gt;If inserted without using a jig it seems to be fine, AutoCAD must analyse the constraints within a block more thoroughly and properly kick everything into position.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2013 08:34:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4294767#M49227</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-06-11T08:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4294817#M49228</link>
      <description>You have to append the new BlockTableRecord to the drawing and the current space before setting properties.</description>
      <pubDate>Tue, 11 Jun 2013 10:10:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4294817#M49228</guid>
      <dc:creator>DiningPhilosopher</dc:creator>
      <dc:date>2013-06-11T10:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4295081#M49229</link>
      <description>&lt;P&gt;Hi DiningPhilosopher,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made that change. The jigged object is now inserted correctly (modified with grips in the correct place) but it's&amp;nbsp;&lt;SPAN&gt;still not displaying the modified block within the jig (just the block definition)&lt;/SPAN&gt;. It is an improvement but hopeing there's a solution still.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        Using trans As Transaction = db.TransactionManager.StartTransaction()
            Dim bt As BlockTable = TryCast(trans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
            Dim btr As BlockTableRecord = TryCast(trans.GetObject(bt(BlockName), OpenMode.ForRead), BlockTableRecord)
            If btr IsNot Nothing Then
                Dim br As New BlockReference(New Point3d(0, 0, 0), btr.ObjectId)
                Dim modelspace As BlockTableRecord = TryCast(trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
                modelspace.AppendEntity(br)
                trans.AddNewlyCreatedDBObject(br, True)
                Dim pc As DynamicBlockReferencePropertyCollection = br.DynamicBlockReferencePropertyCollection
                For i = 0 To pc.Count - 1
                    Dim prop As DynamicBlockReferenceProperty = pc(i)
                    If prop.PropertyName = "A" Then prop.Value = 500.0#
                    If prop.PropertyName = "B" Then prop.Value = 500.0#
                    If prop.PropertyName = "C" Then prop.Value = 500.0#
                Next
                trans.TransactionManager.QueueForGraphicsFlush()
                doc.TransactionManager.FlushGraphics()
                If AcadNetAddinWizard_Namespace.BlockMovingRotating.Jig(br) Then
                End If
                trans.Commit()
            End If
        End Using&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2013 13:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4295081#M49229</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-06-11T13:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4296739#M49230</link>
      <description>&lt;P&gt;You should set the DynamicBlockReferenceProperty's outside of your Transaction, after the commit.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2013 18:26:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4296739#M49230</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-06-12T18:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4296850#M49231</link>
      <description>&lt;P&gt;Hi Fenton,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like the modified block to display as modified before the jigging.&lt;/P&gt;&lt;P&gt;I've have tried modifying the blockreference within a seperate transaction and comitting it before the jig.&lt;/P&gt;&lt;P&gt;FlushGraphics doesn't seem to work.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FlushGraphics also shows &amp;nbsp;the block at the insertion point until after the jig.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;No idea why I can't get this to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2013 19:49:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4296850#M49231</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-06-12T19:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modify Dynamic Block Properties before Jig</title>
      <link>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4301160#M49232</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This behavior seems specific to the drawing that you attached. I could not reproduce it with a simple dynamic block that I was using to test this behavior. I have attached a test drawing with the dynamic block that I created.&lt;/P&gt;
&lt;P&gt;I may be missing some of the details of your dynamic block.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A workaround in your case could be to have two custom commands. Not an elegant solution, but it worked ok with your drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ObjectId _brefId = ObjectId.Null;

[CommandMethod("Test1")]
public void Test1()
{
    // Insert the block reference and set the parameters
    // Store the ObjectId of the block ref in _brefId

    // Call another command to jig the inserted block reference
    Application.DocumentManager.MdiActiveDocument.SendStringToExecute("Test2 ", false, false, false);
}
            
[CommandMethod("Test2")]
public void Test2()
{
   // Use _brefId to access the inserted block reference
   // Jig the block reference and set its transform
}&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2013 08:27:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modify-dynamic-block-properties-before-jig/m-p/4301160#M49232</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-06-18T08:27:32Z</dc:date>
    </item>
  </channel>
</rss>

