<?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 Retrieve info from Block inserted in dwg inserted in another one (XRef in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/retrieve-info-from-block-inserted-in-dwg-inserted-in-another-one/m-p/7604421#M28730</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello , coninuing from my last post :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769" target="_blank"&gt;https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;i need to extract information :&lt;/P&gt;
&lt;P&gt;- Position of the block in xref (but position on WCS on the current dwg).&lt;/P&gt;
&lt;P&gt;- Scale X or Y or Z of the block in xref (but position on WCS on the current dwg)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have this code for getting the entity :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim opt As PromptNestedEntityOptions = New PromptNestedEntityOptions(vbCrLf &amp;amp; cTexteInfo)
                    opt.AllowNone = False
                    Dim BlocRef As BlockReference = Nothing

retry:
                    Dim prompSelRes As PromptNestedEntityResult
                    Do While (True)
                        prompSelRes = Ed.GetNestedEntity(opt)

                        If (prompSelRes.Status = PromptStatus.Cancel) Then Return "annulation manuelle"

                        Dim entity = tr.GetObject(prompSelRes.ObjectId, OpenMode.ForRead)
                        If TypeOf (entity) Is AttributeReference Then
                            'aquisition du bloc réf
                            BlocRef = tr.GetObject(entity.OwnerId, OpenMode.ForRead)
                            Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref[att]) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Dim containers = prompSelRes.GetContainers()
                        If (containers.Length &amp;gt; 0) Then
                            BlocRef = tr.GetObject(containers(0), OpenMode.ForRead)
                            'Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Ed.WriteMessage(vbCrLf &amp;amp; "L'objet sélectionné n'est pas un bloc.")
                    Loop&lt;/PRE&gt;
&lt;P&gt;with this i have the BlockRef and i can retrieve the BlockDef (see the link above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but now , how i can check the position in the current drawing ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i trying : (from&amp;nbsp; &lt;A href="http://spiderinnet1.typepad.com/blog/2013/12/recreate-autocad-nested-entity-with-net-promptnestedentityresult-and-transform-matrix3d.html" target="_blank"&gt;here&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Dim brMat As Matrix3d = Matrix3d.Identity&lt;BR /&gt;brMat = brMat.PreMultiplyBy(BlocRef.BlockTransform)&lt;BR /&gt;brMat = brMat.PreMultiplyBy(brMat.Inverse())&lt;BR /&gt;brMat = brMat.PostMultiplyBy(brMat)&lt;BR /&gt;&lt;BR /&gt;Dim newEnt As Entity = BlocRef.Clone()&lt;BR /&gt;newEnt.TransformBy(prompSelRes.Transform.PostMultiplyBy(Matrix3d.Displacement(New Vector3d(0.1, 0.1, 0))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but this not working and crash if the block have a scale of 1/0.9/0.9&amp;nbsp; for exemple ...&lt;/P&gt;
&lt;P&gt;The .position from the new block is not good too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can you help me ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I need this for create a arc with point1/point&amp;nbsp; is the location of 2 block in Xref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2017 12:56:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-12-07T12:56:05Z</dc:date>
    <item>
      <title>Retrieve info from Block inserted in dwg inserted in another one (XRef</title>
      <link>https://forums.autodesk.com/t5/net-forum/retrieve-info-from-block-inserted-in-dwg-inserted-in-another-one/m-p/7604421#M28730</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello , coninuing from my last post :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769" target="_blank"&gt;https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;i need to extract information :&lt;/P&gt;
&lt;P&gt;- Position of the block in xref (but position on WCS on the current dwg).&lt;/P&gt;
&lt;P&gt;- Scale X or Y or Z of the block in xref (but position on WCS on the current dwg)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have this code for getting the entity :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim opt As PromptNestedEntityOptions = New PromptNestedEntityOptions(vbCrLf &amp;amp; cTexteInfo)
                    opt.AllowNone = False
                    Dim BlocRef As BlockReference = Nothing

retry:
                    Dim prompSelRes As PromptNestedEntityResult
                    Do While (True)
                        prompSelRes = Ed.GetNestedEntity(opt)

                        If (prompSelRes.Status = PromptStatus.Cancel) Then Return "annulation manuelle"

                        Dim entity = tr.GetObject(prompSelRes.ObjectId, OpenMode.ForRead)
                        If TypeOf (entity) Is AttributeReference Then
                            'aquisition du bloc réf
                            BlocRef = tr.GetObject(entity.OwnerId, OpenMode.ForRead)
                            Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref[att]) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Dim containers = prompSelRes.GetContainers()
                        If (containers.Length &amp;gt; 0) Then
                            BlocRef = tr.GetObject(containers(0), OpenMode.ForRead)
                            'Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Ed.WriteMessage(vbCrLf &amp;amp; "L'objet sélectionné n'est pas un bloc.")
                    Loop&lt;/PRE&gt;
&lt;P&gt;with this i have the BlockRef and i can retrieve the BlockDef (see the link above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but now , how i can check the position in the current drawing ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i trying : (from&amp;nbsp; &lt;A href="http://spiderinnet1.typepad.com/blog/2013/12/recreate-autocad-nested-entity-with-net-promptnestedentityresult-and-transform-matrix3d.html" target="_blank"&gt;here&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Dim brMat As Matrix3d = Matrix3d.Identity&lt;BR /&gt;brMat = brMat.PreMultiplyBy(BlocRef.BlockTransform)&lt;BR /&gt;brMat = brMat.PreMultiplyBy(brMat.Inverse())&lt;BR /&gt;brMat = brMat.PostMultiplyBy(brMat)&lt;BR /&gt;&lt;BR /&gt;Dim newEnt As Entity = BlocRef.Clone()&lt;BR /&gt;newEnt.TransformBy(prompSelRes.Transform.PostMultiplyBy(Matrix3d.Displacement(New Vector3d(0.1, 0.1, 0))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but this not working and crash if the block have a scale of 1/0.9/0.9&amp;nbsp; for exemple ...&lt;/P&gt;
&lt;P&gt;The .position from the new block is not good too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can you help me ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I need this for create a arc with point1/point&amp;nbsp; is the location of 2 block in Xref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2017 12:56:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/retrieve-info-from-block-inserted-in-dwg-inserted-in-another-one/m-p/7604421#M28730</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-07T12:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve info from Block inserted in dwg inserted in another one (XRef</title>
      <link>https://forums.autodesk.com/t5/net-forum/retrieve-info-from-block-inserted-in-dwg-inserted-in-another-one/m-p/7611015#M28731</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello , coninuing from my last post :&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769" target="_blank"&gt;https://forums.autodesk.com/t5/net/extract-attribut-info-from-a-block-in-a-xref/m-p/6829239#M51769&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i need to extract information :&lt;/P&gt;&lt;P&gt;- Position of the block in xref (but position on WCS on the current dwg).&lt;/P&gt;&lt;P&gt;- Scale X or Y or Z of the block in xref (but position on WCS on the current dwg)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have this code for getting the entity :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim opt As PromptNestedEntityOptions = New PromptNestedEntityOptions(vbCrLf &amp;amp; cTexteInfo)
                    opt.AllowNone = False
                    Dim BlocRef As BlockReference = Nothing

retry:
                    Dim prompSelRes As PromptNestedEntityResult
                    Do While (True)
                        prompSelRes = Ed.GetNestedEntity(opt)

                        If (prompSelRes.Status = PromptStatus.Cancel) Then Return "annulation manuelle"

                        Dim entity = tr.GetObject(prompSelRes.ObjectId, OpenMode.ForRead)
                        If TypeOf (entity) Is AttributeReference Then
                            'aquisition du bloc réf
                            BlocRef = tr.GetObject(entity.OwnerId, OpenMode.ForRead)
                            Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref[att]) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Dim containers = prompSelRes.GetContainers()
                        If (containers.Length &amp;gt; 0) Then
                            BlocRef = tr.GetObject(containers(0), OpenMode.ForRead)
                            'Ed.WriteMessage(vbCrLf &amp;amp; "Nom du bloc (Xref) : " &amp;amp; BlocRef.Name)
                            Exit Do
                        End If

                        Ed.WriteMessage(vbCrLf &amp;amp; "L'objet sélectionné n'est pas un bloc.")
                    Loop&lt;/PRE&gt;&lt;P&gt;with this i have the BlockRef and i can retrieve the BlockDef (see the link above).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now , how i can check the position in the current drawing ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i trying : (from&amp;nbsp; &lt;A href="http://spiderinnet1.typepad.com/blog/2013/12/recreate-autocad-nested-entity-with-net-promptnestedentityresult-and-transform-matrix3d.html" target="_blank"&gt;here&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;Dim brMat As Matrix3d = Matrix3d.Identity&lt;BR /&gt;brMat = brMat.PreMultiplyBy(BlocRef.BlockTransform)&lt;BR /&gt;brMat = brMat.PreMultiplyBy(brMat.Inverse())&lt;BR /&gt;brMat = brMat.PostMultiplyBy(brMat)&lt;BR /&gt;&lt;BR /&gt;Dim newEnt As Entity = BlocRef.Clone()&lt;BR /&gt;newEnt.TransformBy(prompSelRes.Transform.PostMultiplyBy(Matrix3d.Displacement(New Vector3d(0.1, 0.1, 0))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but this not working and crash if the block have a scale of 1/0.9/0.9&amp;nbsp; for exemple ...&lt;/P&gt;&lt;P&gt;The .position from the new block is not good too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I need this for create a arc with point1/point&amp;nbsp; is the location of 2 block in Xref.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;See the &lt;STRONG&gt;&lt;EM&gt;Transform&lt;/EM&gt; &lt;/STRONG&gt;property of the PromptNestedEntityResult.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You also cannot use Clone() to copy a BlockReference and its attributes. You should use the Database's DeepCloneObjects() method for that.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 21:59:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/retrieve-info-from-block-inserted-in-dwg-inserted-in-another-one/m-p/7611015#M28731</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-12-09T21:59:32Z</dc:date>
    </item>
  </channel>
</rss>

