jueves, 24 de noviembre de 2022

my_first_autocad_plugin (https://knowledge.autodesk.com/support/autocad/learn-explore/caas/simplecontent/content/lesson-2-getting-to-know-your-development-environment.html)

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
 
Namespace HorizontalAttributes
 
    Public Class Commands
        Private Shared myOverrule As KeepStraightOverrule
        <CommandMethod("KeepStraight")>
        Public Shared Sub ImplementOverrule()
            If myOverrule Is Nothing Then
                myOverrule = New KeepStraightOverrule
                Overrule.AddOverrule(RXClass.GetClass(GetType(AttributeReference)), myOverrule, False)
            End If
            Overrule.Overruling = True
        End Sub
    End Class
 
    Public Class KeepStraightOverrule
        Inherits TransformOverrule
        Public Overrides Sub TransformBy(ByVal entity As Entity, ByVal transform As Matrix3d)
            MyBase.TransformBy(entity, transform)
            Dim attRef As AttributeReference = entity
            attRef.Rotation = 0.0
        End Sub
    End Class
End Namespace

No hay comentarios:

Publicar un comentario