How to set the standard

In AutoCAD Mechanical, standards are the... well standards by which other things are measured. We base everything off the ISO standard so that we are all on the same "page" so to speak. Most of our customers live by this standard, so it becomes even more important to adhere to their "gold standard" (hint hint ... final payment). Anyway, we generally use a template to start drawings with our standard in place. We have had times where a rogue user or an outside drawing made its way into the mix, so I came up with a little macro to "set the standard". After setting a reference to the SymBBAuto library, use the following to get the standard you always wanted.

Private Sub SetMeStdToIso()
On Error Resume Next
Dim mcadSymBb As McadSymbolBBMgr
Dim mcadStdMgr As McadStandardMgr
Dim mcadStd As McadStandard
Set mcadSymBb = ThisDrawing.Application.GetInterfaceObject("SymBBAuto.McadSymbolBBMgr")
Set mcadStdMgr = mcadSymBb.StandardMgr

mcadStdMgr.CurrentStandardName = "ISO"
If mcadStdMgr.StandardCount > 1 Then
For Each mcadStd In mcadStdMgr.Standards
If mcadStd.name <> "ISO" Then 'Or mcadStd.Name <> "DIN" Then
End If
Next mcadStd
End If
End Sub


Now for my next trick...

How to make the invisible disappear. Why bother you say. What I found out recently is, what I can't see can hurt me. We convert our files to our customers formats once we have completed their jobs. We convert our layer/linetype structure to their layer/linetype structure. I have created macros to do that for us and they work pretty well. Recently these macros would take an inordinate amount of time to work or even crashing AutoCAD after processing a single drawing for an hour or so. What's happening? The macro would purge the drawings and process all blocks to redefine their "innards". I would see blocks flash on that were not in the drawing. Hmmmm... I thought about it. They are either referenced by something in the drawing and can't be purged or.... they were invisible. AutoCAD now has the power to make things invisible (if you did not know). So, I pulled up a trusty macro I built from some other posts and then like magic, the drawing went from 22 mb to 5 mb and converting layers took 10 seconds. Wow. I am posting this gem in case you need some "magic" also.

Public Sub DeleteInvisibleEnts()
'DeleteInvisibleEnts: Makes all objects in an AutoCAD drawing visible.
Dim acSs As AcadSelectionSet
Dim dPt1(0 To 2) As Double
Dim dPt2(0 To 2) As Double
Dim acObj As AcadObject
Dim acLyr As AcadLayer
Dim acLyrs As AcadLayers
Dim sCurrLyr As String
Dim iCode(0) As Integer
Dim vVal(0) As Variant

Set acLyrs = ThisDrawing.Layers
iCode(0) = 60 'visibilty pair
vVal(0) = 1 '1=invisible, 0=visible

Set acSs = ThisDrawing.SelectionSets.Add("INVIS")
acSs.Select acSelectionSetAll, dPt1, dPt2, iCode, vVal 'ALL OBJECTS
'Cycle through all objects
For Each acObj In acSs
If acObj.Visible = False Then
sCurrLyr = acObj.layer
Set acLyr = acLyrs.Item(sCurrLyr)
'Check for locked layer, and unlock it if it is
If acLyr.Lock Then
acLyr.Lock = False 'Unlock the Layer.
acObj.Visible = True 'Display the invisible item
acLyr.Lock = True 'Re-lock the Layer.
acObj.Visible = True
End If
End If
Next acObj
'If you stop here, all invisible items are now visible
Call DeleteAllObjsFromSelSet(acSs) 'A macro to cycle thru and delete the items
If Not acSs Is Nothing Then
End If

End Sub


Shooting star.. uhmmm symbol I mean

Geometric tolerances with their own mind... stop it! When he would add a geometric tolerance symbol and then would try to place it (while ortho was on), it would shoot to a distant location away from his desired spot. The solution. I noticed his UCS icon was not set to world (a small square around the origin). When we set it back to world. Tada! We were back in business. I wish they were all so easy.