Ad

Friday, May 09, 2014

Change MLeader Number

Here is some old VBA code for changing mleader numbers.

Sub ChangeMLeaderNumber()

    Dim oAcadObject As AcadObject

    Dim sOriginalNumber As String

    Dim sChangedNumber As String

    Dim oMLeader As AcadMLeader

    Dim oAttDef As AcadAttribute

    sOriginalNumber = ThisDrawing.Utility.GetString(1, "Enter existing MLeader Number to change: ")

    sChangedNumber = ThisDrawing.Utility.GetString(1, "Enter new MLeader Number: ")

    For Each oAcadObject In ThisDrawing.ModelSpace

        If (TypeOf oAcadObject Is AcadMLeader) Then

            Set oMLeader = oAcadObject

            Dim sBlock As String

            sBlock = oMLeader.ContentBlockName

            Dim oEnt As AcadEntity

            For Each oEnt In ThisDrawing.Blocks(sBlock)

                If oEnt.ObjectName = "AcDbAttributeDefinition" Then

                    Set oAttDef = oEnt

                    If oAttDef.TagString = "CIRCLE" And oAttDef.TextString = sOriginalNumber Then

                        oMLeader.SetBlockAttributeValue oAttDef.ObjectID, sChangedNumber

                    End If

                End If

            Next

        End If

    Next

End Sub

Monday, May 05, 2014

Adding Arborescence to the Toolbox

A while back I did a blog post regarding the Toolbox. I don’t remember what it was about, but it included this image. This image contains a whole lot of non out of the box arborescence, or options.

image001

You might want to know how you too can have an awesomely full Toolbox. It is super easy to do if you love user permissions. This is how my work flow usually goes.

  • Press the Edit Toolbox Content button.

 image

  •   Next press this button to add a new root category. That isn’t a typo, the button is called this.

image

  • Next rename the Root Category to the name you want to use. I’ve renamed mine Super. To add a new Category below the Root Category, right click on the Root Category and select ‘New Category…’

image

  • Once you create a category you can add either another category or a tool by right clicking on the new Category.

image

  • Once you are done press the Save Button. That’s that 2.5” floppy disk looking thingy.

image

  • Now you can close the Panorama tab by pressing the Check Box next to the save button.

It should then be saved and added to the ToolBox.

image

Now it may not show up and I probably should put this part at the top of the list, especially if you don’t read all of the directions first. These steps won’t work if you don’t have permission to write to this folder: C:\ProgramData\Autodesk\C3D 2014\enu\Data\Toolbox so if you don’t, you’ll have to get it.

You can also modify the ToolBoxCfg.xml to contain create your own folders (or create a new XML file). If the XML file is in this folder, it will automatically be added to the Toolbox. It is probably a good idea to create your own in case Autodesk modifies it during a Service Pack. To create your own, copy the ToolBoxCfg.xml file and give it a new name and then edit the contents. Either from the Toolbox or from an XML editor such as Notepad, Notepad XML, or Notepad++.

LinkWithin

Blog Widget by LinkWithin

Ad