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

lunes, 7 de noviembre de 2022

EXCEL com detectar el color de fons d'una cel·la

 https://www.exceldemy.com/excel-get-cell-color/

The GET.CELL Function: an Overview

We are using GET.CELL to return more information about the worksheet setting than is achievable with the CELL function. We don’t need any VBA code here to implement this.

The Basic Syntax:

=GET.CELL(type_num, reference)

type_num is a number that specifies what type of cell information you want.

The following list shows the possible values of type_num and the corresponding results.

One problem is that you cannot use the GET.CELL directly in the worksheet.

The steps are as stated below:

1. Go to Formulas >Name Manager. A Name Manager dialog box will appear.

2. Then, click on New.

excel name manager dialog box

3. Give it any name.

4. In the Refers to box, type the following format:

=GET.CELL(63,INDIRECT("rc",FALSE))

As we are working with background colors, we are using 63 in the type_num argument.

excel get.cell function to get cell color

5. Finally, click Ok.

Now, you can use the GET.CELL with the name that you have given.