<?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 Clone block with points in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4337890#M48598</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a object which im cloning and moving along a path.I am finding the GeometricExtentsBestFit points of the block and plotting in the drawing.I want to clone the object with these points.Any idea on how to do this.Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;D&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff"&gt;im&lt;/FONT&gt; bref &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockReference = actran.GetObject(idsBox(0), OpenMode.ForWrite).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; BlockCloneNew &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockReference = bref.Clone()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; bestFit &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;Extents3d = bref.GeometryExtentsBestFit&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; bestfitMin &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Point3d = bestFit.MinPoint&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Dim bestfitMax1 &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Point3d = bestFit1.MaxPoint&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Thanks in advance&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2013 06:00:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-07-22T06:00:19Z</dc:date>
    <item>
      <title>Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4337890#M48598</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a object which im cloning and moving along a path.I am finding the GeometricExtentsBestFit points of the block and plotting in the drawing.I want to clone the object with these points.Any idea on how to do this.Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;D&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff"&gt;im&lt;/FONT&gt; bref &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockReference = actran.GetObject(idsBox(0), OpenMode.ForWrite).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; BlockCloneNew &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; BlockReference = bref.Clone()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; bestFit &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt;Extents3d = bref.GeometryExtentsBestFit&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt; bestfitMin &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Point3d = bestFit.MinPoint&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Dim bestfitMax1 &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;As&lt;/FONT&gt;&lt;/FONT&gt; Point3d = bestFit1.MaxPoint&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Thanks in advance&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 06:00:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4337890#M48598</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-22T06:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4338001#M48599</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can someone suggest me on how to make the block and points as a single entity as mentioned above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 07:47:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4338001#M48599</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-22T07:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342766#M48600</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean, you need to display the block reference clone and its extent points along the path ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case, using transient graphics to show them might help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code that you can try. When prompted select a block reference and a polyline path. The block reference is cloned and displayed along the path at sampled points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Class Test
    Implements IExtensionApplication

    Private _markers As DBObjectCollection = Nothing

    &amp;lt;CommandMethod("Test")&amp;gt; _
    Public Sub TestMethod()
        Dim activeDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim db As Database = activeDoc.Database
        Dim ed As Editor = activeDoc.Editor

        Dim peo1 As New PromptEntityOptions("Select a block reference : ")
        peo1.SetRejectMessage("Not a block reference")
        peo1.AddAllowedClass(GetType(BlockReference), True)
        Dim per1 As PromptEntityResult = ed.GetEntity(peo1)
        If per1.Status &amp;lt;&amp;gt; PromptStatus.OK Then
            Return
        End If
        Dim brefId As ObjectId = per1.ObjectId

        Dim peo2 As New PromptEntityOptions("Select a polyline : ")
        peo2.SetRejectMessage("Not a polyline")
        peo2.AddAllowedClass(GetType(Polyline), True)
        Dim per2 As PromptEntityResult = ed.GetEntity(peo2)
        If per2.Status &amp;lt;&amp;gt; PromptStatus.OK Then
            Return
        End If
        Dim plineId As ObjectId = per2.ObjectId

        ClearTransientGraphics()
        _markers = New DBObjectCollection()

        Dim intCol As New IntegerCollection()

        Dim samplePoints As New Point3dCollection

        Using tr As Transaction = db.TransactionManager.StartTransaction()
            Dim bref As BlockReference = TryCast(tr.GetObject(brefId, OpenMode.ForRead), BlockReference)
            Dim pline As Polyline = TryCast(tr.GetObject(plineId, OpenMode.ForRead), Polyline)

            If pline IsNot Nothing Then
                Dim segCount As Integer = pline.NumberOfVertices
                For cnt As Integer = 0 To segCount - 1
                    Dim vertexPt As Point3d = pline.GetPoint3dAt(cnt)
                    Dim type As SegmentType = pline.GetSegmentType(cnt)

                    Select Case type
                        Case SegmentType.Arc

                            Dim arc2d As CircularArc2d = pline.GetArcSegment2dAt(cnt)
                            Dim samplePts1 As Point2d() = arc2d.GetSamplePoints(5)
                            For Each pt2d As Point2d In samplePts1
                                samplePoints.Add(New Point3d(pt2d.X, pt2d.Y, 0.0))
                            Next
                            Exit Select

                        Case SegmentType.Line

                            Dim line2d As LineSegment2d = pline.GetLineSegment2dAt(cnt)
                            Dim samplePts2 As Point2d() = line2d.GetSamplePoints(5)
                            For Each pt2d As Point2d In samplePts2
                                samplePoints.Add(New Point3d(pt2d.X, pt2d.Y, 0.0))
                            Next
                            Exit Select
                    End Select
                Next
            End If

            For Each pt As Point3d In samplePoints
                Dim marker1 As BlockReference
                marker1 = bref.Clone()
                marker1.Position = pt
                Autodesk.AutoCAD.GraphicsInterface.TransientManager.CurrentTransientManager.AddTransient(marker1, Autodesk.AutoCAD.GraphicsInterface.TransientDrawingMode.Highlight, 128, intCol)
                _markers.Add(marker1)

                Dim exts As Extents3d
                exts = marker1.GeometryExtentsBestFit()

                Dim marker2 As DBObject
                'marker2 = New DBPoint(exts.MinPoint)
                marker2 = New Circle(exts.MinPoint, Vector3d.ZAxis, 0.1)
                Autodesk.AutoCAD.GraphicsInterface.TransientManager.CurrentTransientManager.AddTransient(marker2, Autodesk.AutoCAD.GraphicsInterface.TransientDrawingMode.Highlight, 128, intCol)
                _markers.Add(marker2)

                Dim marker3 As DBObject
                'marker3 = New DBPoint(exts.MaxPoint)
                marker3 = New Circle(exts.MaxPoint, Vector3d.ZAxis, 0.1)
                Autodesk.AutoCAD.GraphicsInterface.TransientManager.CurrentTransientManager.AddTransient(marker3, Autodesk.AutoCAD.GraphicsInterface.TransientDrawingMode.Highlight, 128, intCol)
                _markers.Add(marker3)
            Next

            tr.Commit()
        End Using
    End Sub

    Private Sub IExtensionApplication_Initialize() Implements IExtensionApplication.Initialize
    End Sub

    Private Sub ClearTransientGraphics()
        Dim intCol As New IntegerCollection()
        If _markers IsNot Nothing Then
            For Each marker As DBObject In _markers
                Autodesk.AutoCAD.GraphicsInterface.TransientManager.CurrentTransientManager.EraseTransient(marker, intCol)
                marker.Dispose()
            Next
        End If
    End Sub

    Private Sub IExtensionApplication_Terminate() Implements IExtensionApplication.Terminate
        ClearTransientGraphics()
    End Sub
End Class&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 09:32:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342766#M48600</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-07-25T09:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342806#M48601</link>
      <description>Hi Balaji,&lt;BR /&gt;Thanks a lot for the reply.I want to display block and its extent points along a path.But this should be placed with respect to 2 points on the block.So when i move the block at certain intervals it is sometimes at an angle wrt the path, in such scenarios the geometric extents is not coming correctly.So i want to calculate the geometricextents initially and treat points and block as one entity and clone.Is this possible.I hope i am clear.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Thu, 25 Jul 2013 10:21:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342806#M48601</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-25T10:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342858#M48602</link>
      <description>&lt;P&gt;Sorry. I do not get the exact picture. Can you please share a drawing or a screenshot of what you are trying to do ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 11:34:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342858#M48602</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-07-25T11:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342865#M48603</link>
      <description>Hi ,&lt;BR /&gt;I just want to know if for a block I get the geometricextents and plot the points.Is there any function or api to convert this block and set of points as one entity.I want to clone this points and block as a single entity.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Gulzar</description>
      <pubDate>Thu, 25 Jul 2013 11:42:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4342865#M48603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-25T11:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4343144#M48605</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Point3d structure do not inherit from Entity neither from DBObject. A Point3d instance is only a geomeric object and cannot be added to an entity or cloned as DBObject instances.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can create DBPoint instances, which are entities, from the Point3d and create a new BlockTableRecord which contains the source block reference and the DBPoint instances, then, insert it and clone it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But you may also get the extents of the cloned object...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or if you want to embed the extents (coordinates) of the source object to the cloned one(s), you can store them in the source block reference as attributes, xdata or extension dictionary xrecords before doing the cloning operation.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2013 14:39:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4343144#M48605</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-07-25T14:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Clone block with points</title>
      <link>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4343278#M48606</link>
      <description>Hi,&lt;BR /&gt;I am not using the geometricextents function after clone is because in somecases i also do rotation on the block and when i try to retrieve the geometricextents it is giving me the extents for the block position before rotation.So i thought ill make point and block as single entity and clone.How do i make the points as attributes?&lt;BR /&gt;thanks&lt;BR /&gt;Gulzar</description>
      <pubDate>Thu, 25 Jul 2013 16:05:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/clone-block-with-points/m-p/4343278#M48606</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-25T16:05:53Z</dc:date>
    </item>
  </channel>
</rss>

