.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cain I create dynamics block with .net

1 REPLY 1
SOLVED
Reply
Message 1 of 2
ceitan666
631 Views, 1 Reply

Cain I create dynamics block with .net

Hi every one in this place.

I am new with this of using vb.net to customize the autocad. and I have found some obstacules. this is what I want to do:

make a plug-in with some commands thats insert blocks, specifically dynamic blocks that can rotate.

the problem:

I can create normal blocks with lines,circles and hatch but I can't make a dynamic block or add dynamic attributes to my blocks

 

 

I have searched the web and found that in the 2008, making a dynamic blocks was impossible. my question is the next:

It is possible to do it now? can  I add a rotating property to my blocks?

 

this is a piece of my code:

 

    Private Sub crearBloqueToma(ByRef blockDefToma As BlockTableRecord, ByRef trans As Transaction, ByRef dwg As Database, ByRef blockTable As BlockTable)
        blockTable.UpgradeOpen()
        blockTable.Add(blockdeftoma)
        trans.AddNewlyCreatedDBObject(blockdeftoma, True)
        blockdeftoma.Comments = "Bloque propiedad de Data Center Consultores."
        'se crean y agregan los elementos que conformarán el hatch
        Dim arcoh As New Arc(New Point3d(0, 0, 0), Vector3d.ZAxis, 10, 0.43633, 2.7053)
        Dim lineah As New Line(arcoh.StartPoint, arcoh.EndPoint)
        arcoh.SetDatabaseDefaults()
        arcoh.Color = Color.FromRgb(0, 255, 255)
        lineah.Color = Color.FromRgb(0, 255, 0)
        blockdeftoma.AppendEntity(arcoh)
        blockdeftoma.AppendEntity(lineah)
        trans.AddNewlyCreatedDBObject(arcoh, True)
        trans.AddNewlyCreatedDBObject(lineah, True)

        '' se crea una coleccion de objetos para crear el area del Hatch

        Dim acObjIdColl As ObjectIdCollection = New ObjectIdCollection()
        acObjIdColl.Add(arcoh.ObjectId)
        acObjIdColl.Add(lineah.ObjectId)


        'se crea y agrega el hatch al bloque
        Dim acHatch As Hatch = New Hatch()
        blockdeftoma.AppendEntity(acHatch)

        trans.AddNewlyCreatedDBObject(acHatch, True)
        acHatch.SetDatabaseDefaults()
        acHatch.SetHatchPattern(HatchPatternType.PreDefined, "SOLID")
        acHatch.Associative = True 'se debe escoger el tipo asociativo despues de agregar el hatch y antes de agregar el "loop"
        acHatch.AppendLoop(HatchLoopTypes.Outermost, acObjIdColl)
        acHatch.Color = Color.FromRgb(255, 0, 255)


        'se borran los bordes del hatch
        ' blockDefToma.RemoveField(arcoh.ObjectId)
        ' blockDefToma.RemoveField(lineah.ObjectId)

        'se crean las lineas y el circulo que conforma el bloque
        Dim linea1 As New Line(New Point3d(9, 4.2259, 0), New Point3d(-17.56, 4.2259, 0))
        Dim linea2 As New Line(New Point3d(9, -3.94, 0), New Point3d(-17.56, -3.94, 0))
        Dim circulo As New Circle(New Point3d(0, 0, 0), Vector3d.ZAxis, 10)


        'se agregan los colores
        linea1.Color = Color.FromRgb(0, 255, 0)
        linea2.Color = Color.FromRgb(0, 255, 0)
        circulo.Color = Color.FromRgb(0, 255, 255)



        'se agregan los elementos al bloque
        blockdeftoma.AppendEntity(linea1)
        blockdeftoma.AppendEntity(linea2)
        blockdeftoma.AppendEntity(circulo)


        'se agregan los objetos al manejador de transacciones para que las autocierre
        trans.AddNewlyCreatedDBObject(circulo, True)
        trans.AddNewlyCreatedDBObject(linea1, True)
        trans.AddNewlyCreatedDBObject(linea2, True)
end sub

 

 

thanks for all of your help and sorry if my english was bad, I am from Costa Rica

1 REPLY 1
Message 2 of 2
Balaji_Ram
in reply to: ceitan666

Hi,

 

Sorry, creating dynamic block through code is not possible yet.

 

You can have sample drawings that have such dynamic blocks and import them to the current drawing.

Updating the properties of an existing dynamic block reference can be done through code.

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost