Quantcast
Viewing all articles
Browse latest Browse all 14319

record history doesn't work on creating an extruded hehagon

 

Hi,

I am trying to create an extruded hexagon

EVERYTHING WORKS.... BUT:

after the creation of the hexagon the grips are not available even i added the proper code

(Polygon3d.record history = true)

Can somebody help me?

 

 

Thanks

 

See bellow my function.

 

    Public Function extrude_Hexagon(ByVal Centre_point As Point3d, ByVal radius_hexagon As Double, ByVal height_hexagon As Double) As Solid3d
        Try
            Dim ThisDrawing As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim Editor1 As Autodesk.AutoCAD.EditorInput.Editor = ThisDrawing.Editor
            Using Lock1 As DocumentLock = ThisDrawing.LockDocument


                Using Trans1 As Autodesk.AutoCAD.DatabaseServices.Transaction = ThisDrawing.TransactionManager.StartTransaction
                    Dim BTrecord As Autodesk.AutoCAD.DatabaseServices.BlockTableRecord = Trans1.GetObject(ThisDrawing.Database.CurrentSpaceId, OpenMode.ForWrite)



                    Dim Poly1 As New Autodesk.AutoCAD.DatabaseServices.Polyline

                    Dim Point00 As New Point2d(Centre_point.X + radius_hexagon, Centre_point.Y)
                    Dim Point01 As New Point2d(Centre_point.X + radius_hexagon * Cos(PI / 3), Centre_point.Y + radius_hexagon * Sin(PI / 3))
                    Dim Point02 As New Point2d(Centre_point.X - radius_hexagon * Cos(PI / 3), Centre_point.Y + radius_hexagon * Sin(PI / 3))
                    Dim Point03 As New Point2d(Centre_point.X - radius_hexagon, Centre_point.Y)
                    Dim Point04 As New Point2d(Centre_point.X - radius_hexagon * Cos(PI / 3), Centre_point.Y - radius_hexagon * Sin(PI / 3))
                    Dim Point05 As New Point2d(Centre_point.X + radius_hexagon * Cos(PI / 3), Centre_point.Y - radius_hexagon * Sin(PI / 3))

                    Poly1.AddVertexAt(0, Point00, 0, 0, 0)
                    Poly1.AddVertexAt(1, Point01, 0, 0, 0)
                    Poly1.AddVertexAt(2, Point02, 0, 0, 0)
                    Poly1.AddVertexAt(3, Point03, 0, 0, 0)
                    Poly1.AddVertexAt(4, Point04, 0, 0, 0)
                    Poly1.AddVertexAt(5, Point05, 0, 0, 0)
                    Poly1.Closed = True

                    Dim Segments_collection As New DBObjectCollection
                    Poly1.Explode(Segments_collection)


                    Dim Colectie_Regiune As New DBObjectCollection
                    Colectie_Regiune = Autodesk.AutoCAD.DatabaseServices.Region.CreateFromCurves(Segments_collection)

                    Dim Regiunea As New Region
                    Regiunea = Colectie_Regiune(0)
                    Dim Polygon3d As New Solid3d
                    Polygon3d.RecordHistory = True


                    Polygon3d.Extrude(Regiunea, height_hexagon, 0)



                    BTrecord.AppendEntity(Polygon3d)
                    Trans1.AddNewlyCreatedDBObject(Polygon3d, True)



                    Trans1.Commit()
                    Return Polygon3d

                End Using 



            End Using

        Catch ex As Exception

            MsgBox(ex.Message)
        End Try

    End Function

 

 

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 14319

Trending Articles