CAD

eInvalidLayer when setting LayerTableRecord.IsFrozen to false

English

Found this problem this morning: if you set IsFrozen to false on the current layer, you'll get an Autodesk.AutoCAD.Runtime.Exception with the ErrorStatus at eInvalidLayer. The setter is certainly checking if the layer is current to avoid freezing it, but it should test the value to ignore when it is false.

So you have to check the layer state before changing the property to false:

Etiquettes:

Revit tip: center a text on a point

English

Text as a group

In Revit, texts can only snap to other texts. It's strange, but it's Revit way ;-)

Etiquettes:

Revit: arrange windows horizontally

English

Wiip Wormhole for Autodesk Revit

This should be easy, but it's not possible with Revit standard tools. If there are two windows opened, you can only arrange them vertically. Yet it is handy when you want to display a schedule side by side with a graphical view.

Etiquettes:

Bring an entity to the foreground with VBA

English

VBA does not provide functions to change the draw order of an entity. However, we can use SendCommand for executing DRAWORDER:

Etiquettes:

Get the name of the active AutoCAD document with .NET

English

Here's a little sample code to detect if AutoCAD is running. If it does, it displays the full path of the active drawing.

The code use COM (out of process).

VB.NET

Imports System.Runtime.InteropServices

Module Module1

    Sub Main()
        Try
            Dim acad = Marshal.GetActiveObject("AutoCAD.Application")
            Dim activeDocument = acad.ActiveDocument
            MsgBox("Le chemin complet du document actif est : " & activeDocument.FullName)
        Catch ex As COMException
            Const MK_E_UNAVAILABLE As Integer = &H800401E3
            If ex.ErrorCode = MK_E_UNAVAILABLE Then
                MsgBox("AutoCAD n'est pas en cours d'exécution.")
            Else
                Throw
            End If
        End Try
    End Sub

End Module

Subscribe to RSS - CAD