Hi All,
We have a .NET Code written for AutoCAD 2014, which displays dimension as below :
Public Shared Sub add_dim(ByVal args As ResultBuffer) ' (defun add_dim (val mod / olderr)
Dim ArgsArray As Array
ArgsArray = args.AsArray 'Storing the Arugement list as array
Dim val As String = CType(ArgsArray.GetValue(0), TypedValue).Value
Dim mod_value As String = CType(ArgsArray.GetValue(1), TypedValue).Value
ACADSysVarMgr.save_sysvars() ' (SAVE_SYSVARS)
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(vbLf + "DIM") '(princ "\nDIM")
If (GenFun.WCMATCH(Application.GetSystemVariable("ACADVER"), "14*,15*,16*,19*,22*")) = True Then ' (if (wcmatch (getvar "acadver") "14*,15*,16*") ; R14, 15 & 16 dimension
GenFun.GetEditor.Document.SendStringToExecute("-toolbar dimension show " + vbCrLf, True, False, True) ' ' (command "-toolbar" "dimension" "show") )
End If
Dim get_dimstyle = Nimcad.get_dimstyle(mod_value)
GenFun.GetEditor.Document.SendStringToExecute("DIM restore " + get_dimstyle + " " + vbCrLf, True, False, True) ' (command "DIM" "restore" (GET_DIMSTYLE mod)) ;"ATTDIM") ; Restore Dim Style.
If (val = Nothing And (GenFun.WCMATCH(Application.GetSystemVariable("ACADVER"), "14*,15*,16*,19*,22*"))) Then ' (cond ((and (not val) (wcmatch (getvar "acadver") "14*,15*,16*")) ; R14, 15 & 16 dimension
GenFun.GetEditor.Document.SendStringToExecute(vbCr + " exit dimlinear ", True, False, True) ' (command "exit" "dimlinear")
ElseIf val = Nothing Then ' ((not val) t) ; User selects dim type.
GenFun.GetEditor.Document.SendStringToExecute(vbCr + " exit dimlinear ", True, False, True)
ElseIf val = "L" Then
GenFun.GetEditor.Document.SendStringToExecute(vbCr + " LEADER ", True, False, True) ' ((wcmatch val "L") (command "LEADER")) ; Leader line mode.
ElseIf val = "H" Then
GenFun.GetEditor.Document.SendStringToExecute(vbCr + " HOR ", True, False, True) ' ((wcmatch val "H") (command "HOR")) ; Horozontal dimensions.
ElseIf val = "V" Then
GenFun.GetEditor.Document.SendStringToExecute(vbCr + " VERT ", True, False, True) ' ((wcmatch val "V") (command "VERT")) ; Vertical dimensions.
End If
ACADSysVarMgr.reset_sysvars() ' (RESET_SYSVARS)
End Sub