Jump to content

How to Find Out Entity Name and Property Name


MAzri

Recommended Posts

I'm just wondering how are everyone find out the actual reference for object name, function name, property name et cetera.

 

Is there any documented reference to look into? 

 

So far for function, I refer to this page on autodesk reference guide and cadforum.cz for vla/vlax function.

 

Like for example, i want to add tolerance to code below but it does not work to change the color for Tolerance's dimension line and text. I guess the property name its wrong or the object name is wrong but I could not know for sure and I do not know where to refer to check.

 

(if (wcmatch (vla-get-ObjectName vlobj) "*Dimension,*Leader,*Tolerance")
       (foreach prop '(DimensionLineColor ExtensionLineColor TextColor)
        ;; not all such entity types have all 3 properties, but all have at least one
        (if (vlax-property-available-p vlobj prop)
          (vlax-put vlobj prop 256); ByLayer
        ); if
       ); foreach
      ); if

 

As usual, many thanks for everyone guidance (bow).

Link to comment
Share on other sites

Give these a try. They will show visual lisp properties and dxf codes of selected entities.

 

;;----------------------------------------------------------------------------;;
;; Dump all methods and properties for selected objects               
(defun C:VDumpIt (/ ent)
  (while (setq ent (car (entsel "\nSelect Entity to Dump")))
    (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t)
  )
  (textscr)
  (princ)
)
;;----------------------------------------------------------------------------;;
;; Dump all DXF Group Data             
(defun C:DumpIt (/ ent)
  (while (setq ent (car (entsel "\nSelect Entity to Dump")))
    (mapcar 'print (entget ent '( "*")))
  )
  (textscr)
  (princ)
)

 

  • Like 1
Link to comment
Share on other sites

The dimension variables are massive finding a list with explanations is difficult.

 

This is not bad some may not be correct forget where I found it

(cons 0 "DIMSTYLE")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbDimStyleTableRecord")
(cons 2 Dim_Name) ;Dim style name
(cons 70 0) ; Standard flag
(cons 3 " [m]"); DIMPOST
(cons 4 ""); DIMAPOST
(cons 5 DIMBLK-Name) ;DIMBLK-Name of block instead of default arrowhead
(cons 6 DIMBLK-Name);(cons 6 "ClosedFilled"); DIMBLK1
(cons 7 "");(cons 7 DIMBLK-Name); DIMBLK2
(cons 170 0) ;DIMALT-turns off alternate units
(cons 40 dimscale) ;DIMSCALE-sets the overall scale factor applied to all dimensions
(cons 41 Arrow_Size) ;DIMASZ-sets the size of the arrow/tick
(cons 42 Extension_Line_Origin_Offset); DIMEXO
(cons 43 Dimension_Line_Spacing); DIMDLI
(cons 44 Extension_Above_Dimension_Line) ;DIMEXE-specifies how far to extend the extention line beyound the dim line
(cons 45 0.0); DIMRND
(cons 46 0) ;DIMDLE-sets the distance the dimension line extends beyond the extension line
(cons 47 0.0); DIMTP
(cons 48 0.0); DIMTM
(cons 71 0); DIMTOL
(cons 72 0); DIMLIM
(cons 73 0) ;DIMTIH-controls the position of dimension text inside extention lines ;METTE IL TESTO DI QUOTA ORIZZONTALE
(cons 74 0) ;DIMTOH-controls the position of dimension text outside extention lines
(cons 75 1); DIMSE1 ;1 sopprime la linea di estensione, 0 la lascia
(cons 76 1); DIMSE2 ;1 sopprime la linea di estensione, 0 la lascia
(cons 77 1) ;DIMTAD-controls the vertical position of text in relation to the dim line
(cons 78 3) ;DIMZIN-controls the suppression of zeros
(cons 79 1); DIMAZIN
(cons 140 Text_Height) ;DIMTXT-specifies the height of the text in the dim
(cons 141 Center_Mark_Size); DIMCEN
(cons 142 0.0); DIMTSZ
(cons 143 0.5) ;DIMALTF-controls the scale factor for alt. units
(cons 144 quote_scale); DIMLFAC ;scala di quota
(cons 145 0.0); DIMTVP
(cons 146 0.64); DIMTFAC
(cons 147 Gap_From_dimension_Line_to_Text) ;DIMGAP-sets the distance from around the dim text
(cons 170 0); DIMALT
(cons 171 2) ;DIMALTD-controls the decimal places for units
(cons 172 0) ;DIMTOFL-forces a line inside extension lines
(cons 173 1); DIMSAH
(cons 174 0); DIMTIX
(cons 175 0); DIMSOXD
(cons 176 256); DIMCLRD
(cons 177 256); DIMCLRE
(cons 178 256); DIMCLRT color of text 
(cons 179 0); DIMADEC
(cons 270 2) ;DIMUNIT-sets the units format for all dims ;2 decimale ; 4architettonico
(cons 271 Decimal_Places) ;DIMDEC-sets the number of decimal places of primary units
(cons 272 Tolerance_Decimal_places); DIMTDEC
(cons 273 2) ;DIMALTU-sets the units for alt. units
(cons 275 0) ;DIMAUNIT-sets the angular format for angular dims
(cons 276 1); DIMFRAC
(cons 277 2); DIMLUNIT ;2 decimale ; 4architettonico
(cons 278 0); DIMDSEP
(cons 279 Text_Movement); DIMTMOVE
(cons 280 0) ;DIMJUST-controls the horizontal positioning of dim text
(cons 281 -1); DIMSD1
(cons 282 -1); DIMSD2
(cons 283 1); DIMTOLJ
(cons 284 3); DIMTZIN
(cons 285 1); DIMALTZ
(cons 286 0) ;DIMALTTZ-Toggles the suppression in tolerance values
;(cons 287 0); DIMFIT
;(cons 288 0); DIMUPT
;(cons 289 0); DIMATFIT
(cons 340 (tblobjname "style" "Estilo_Cotas")); DIMTXSTY
;(cons 341 (cdr (assoc 330 (entget (tblobjname "block" "."))))); DIMLDRBLK 
;(cons 342 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK must setvar dimblk 1st 
;(cons 343 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK1
;(cons 344 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK2
;(cons 371 -2); DIMLWD
;(cons 372 -2); DIMLWE

 

Look at DIMCLRT maybe

 

Google  "DIMCLRT Autocad" go down a few suggestions look for the official Autodesk help.

  • Like 2
Link to comment
Share on other sites

2 hours ago, mhupp said:

Give these a try. They will show visual lisp properties and dxf codes of selected entities.

 

 

Many thanks! This is definitely help a lot of those guess work and googling around!

 

From the vdumpit command, i manage to get this dump for the geometric tolerance item. From there, I figured out that the property for the dimensionlinecolor and textcolor is same as my previous code in OP. However its still not working and from what i gather, the object name is not *Tolerance. But checking from Dumpit command, it should be already correct. I wonder what is wrong

 

Select Entity to Dump; IAcadTolerance: AutoCAD Tolerance Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff7399170f8>
;   DimensionLineColor = 7
;   DirectionVector = (1.0 -6.34538e-05 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0000026c6ace8868>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "229"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000002745378b9a8>
;   InsertionPoint = (524.218 -29.7744 6.91266e-10)
;   Layer = "04-G4A_LEFT_RT$0$TEXT-SANI"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 63981
;   ObjectName (RO) = "AcDbFcf"
;   OwnerID (RO) = 63985
;   PlotStyleName = "ByLayer"
;   ScaleFactor = 100.0
;   StyleName = "04-G4A_LEFT_RT$0$SNO-DIM 100"
;   TextColor = 9
;   TextHeight = 1.296
;   TextString = "%%vrwdp%%v%%v%%v%%v"
;   TextStyle = "04-G4A_LEFT_RT$0$DIM"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000002745378aa40>
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)

 

(-1 . <Entity name: 26c5fd0b810>)
(0 . "TOLERANCE")
(330 . <Entity name: 26c5fd169f0>)
(5 . "229")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "04-G4A_LEFT_RT$0$TEXT-SANI")
(100 . "AcDbFcf")
(3 . "04-G4A_LEFT_RT$0$SNO-DIM 100")
(10 524.218 -29.7744 6.91266e-10)
(1 . "%%vrwdp%%v%%v%%v%%v")
(210 0.0 0.0 1.0)
(11 1.0 -6.34538e-05 0.0)

 

Link to comment
Share on other sites

See if this works

(if (setq vla-obj (vlax-ename->vla-object (car (entsel"\nSelect Object"))))
  (progn
    (vla-put-DimensionLineColor vla-obj "ByLayer")
    (vla-put-extensionlinecolor vla-obj "ByLayer")
    (vla-put-TextColor vla-obj "ByLayer")
  )
)

 

  • Like 1
Link to comment
Share on other sites

42 minutes ago, mhupp said:

See if this works

(if (setq vla-obj (vlax-ename->vla-object (car (entsel"\nSelect Object"))))
  (progn
    (vla-put-DimensionLineColor vla-obj "ByLayer")
    (vla-put-extensionlinecolor vla-obj "ByLayer")
    (vla-put-TextColor vla-obj "ByLayer")
  )
)

 

 

Hmm this is interesting. I can use this in my earlier part of my routine to change the tolerance without having to know the name. Heck it can even eliminate the whole routine to find dimension & leader. Thanks!

 

Btw, i found it! The objectname for geometric tolerance is AcDbFcf! It was indicated in the vdumpit command dump. Who knew this is it!

 

;   ObjectName (RO) = "AcDbFcf"

 

Link to comment
Share on other sites

3 hours ago, BIGAL said:

The dimension variables are massive finding a list with explanations is difficult.

 

This is not bad some may not be correct forget where I found it

 

Look at DIMCLRT maybe

 

Google  "DIMCLRT Autocad" go down a few suggestions look for the official Autodesk help.

 

Interesting that dimension have so many variables. But where and how do you generate this list?

Link to comment
Share on other sites

This will expose some of the dxf codes but some items are sub items within that list so have to look at them as a level deeper.

 

Copy this to command line and pick a dim

 

(entget (car (entsel "\npick dim")))

  • Like 1
Link to comment
Share on other sites

This is the list for a dim style rather then individual dimensions.

 

This is taken from a larger LISP to set a dim style so some of the values below are variables (just change them to suit), or commented out as I didn't need that. Single ';' for commented out, double ';;' for variables where I have no clue what they do . After each (setvar .....) is a commented out value - this is the default dim style value. The last 5 lines set a dim style to this list (dim style name is set in my LISP as variable DimStyleName

 

 

;;Full list of dimension variables.
;;Change all or none as required, save and existing style to update
;;NOTE: BYBLOCK and other texts to be numbers?
;;https://help.autodesk.com/view/ACDLTM/2016/ENU/?guid=GUID-30F44A49-4250-42D1-AEF2-5E2914ADB02B
;;         List     value    ;; Default       ;;Description
 (setvar "DIMADEC"  TxtPrecision)  ;; 0       ;;Angular Dimension Decimal Places
;  (setvar "DIMALT"    0)    ;; 0              ;;Control of alternative units 0 - Off 1 - On
  (setvar "DIMALTD"   TxtPrecision)    ;; 2 / 3          ;;Alternative Units Decimal Places
;  (setvar "DIMALTF" 0.0394) ;; 25.4 / 0.0394  ;;Alternative Units Scale Factor
;;(setvar "DIMALTMZF")      ;;                ;;Alternate sub-zero factor for metric dimensions - Unknown variable
;;(setvar "DIMALTMZS")      ;;                ;;Alternate sub-zero suffix for metric dimensions - Unknown variable
;  (setvar "DIMALTRND" 0.00) ;; 0.00           ;;Alternate units rounding value
;  (setvar "DIMALTTD"  3)    ;; 2 / 3          ;;Alternative Units Tolerance Decimal Places
;  (setvar "DIMALTTZ"  0)    ;; 0              ;;Alternate tolerance zero suppression
;  (setvar "DIMALTU"   2)    ;; 2              ;;Alternative Units Units
;  (setvar "DIMALTZ"   0)    ;; 0              ;;Alternate unit zero suppression
;  (setvar "DIMAPOST" "")    ;; ""             ;;Prefix and suffix for alternate text
;  (setvar "DIMARCSYM" 0)    ;; 0              ;;Arc Length Dimension Arc Symbol
  (setvar "DIMASZ" FontHeight) ;; 0.18 / 2.5  ;;Dimension Line and Leader Line Arrow Heads size
;  (setvar "DIMATFIT"  3)    ;; 3              ;;Arrow and text fit if distance is too narrow for both
;  (setvar "DIMAUNIT"  0)    ;; 0              ;;Angular unit format
;  (setvar "DIMAZIN"   0)    ;; 0              ;;Angular Dimension Depresses leading zeros
;  (setvar "DIMBLK"  ".")    ;; "."            ;;Arrow block name "." for closed flled else as properties
;  (setvar "DIMBLK1" ".")    ;; "."            ;;First arrow block name "." for closed flled else as properties
;  (setvar "DIMBLK2" ".")    ;; "."            ;;Second arrow block name "." for closed flled else as properties
  (setvar "DIMCEN" FontHeight) ;; 0.09 / 2.5  ;;Drawing centre mark for radius or diameter dimensions
  (setvar "DIMCLRD" LinCol) ;; 0              ;;Colours - Lines, ArrowHeads, Dimension Lines 0: ByLayer, 256 ByBlock
  (setvar "DIMCLRE" LinCol) ;; 0              ;;Colours - Extension Lines, Centre Marks Colours 0: ByLayer, 256 ByBlock
  (setvar "DIMCLRT" TxtCol) ;; 0              ;;Colours - Dimension Text Colour 0: ByLayer, 256 ByBlock
  (setvar "DIMDEC"  TxtPrecision)  ;; 0       ;;Dimension Decimal Places
;  (setvar "DIMDLE"    0)    ;; 0.0000         ;;Dimension Line extension with oblique strokes instead of arrows
;  (setvar "DIMDLI"    4)    ;; 3.75           ;;Dimension Baseline Dimension Spacing
  (setvar "DIMDSEP" ".")    ;; .              ;;Decimal separator
  (setvar "DIMEXE" (/ Fontheight 2)) ;; 0.18 / 1.25    ;;Extension Line Extension distance
  (setvar "DIMEXO" (/ Fontheight 4)) ;; 0.0625 / 0.625 ;;Extension Line Offset
;  (setvar "DIMFRAC"   0)    ;; 0              ;;Dimension Fraction Format
;  (setvar "DIMFXL" 1.00)    ;; 1              ;;Fixed Extension Line
;  (setvar "DIMFXLON"  0)    ;; 0              ;;Enable Fixed Extension Line 0 - Off 1 - On
  (setvar "DIMGAP" (/ FontHeight 4)) ;; 0.09 / 0.625   ;;Dimension gap between text and arrow 
  (setvar "DIMJOGANG" (* pi (/ 45 180.0))) ;; ;;Radius dimension jog angle.. radians?
;  (setvar "DIMJUST"   0)    ;; 0              ;;Justification of text on dimension line
  (setvar "DIMLDRBLK" ".")  ;; "."            ;;Leader block name "." for closed flled else as properties
;  (setvar "DIMLFAC" 1.00)   ;; 1              ;;Linear unit scale factor
;  (setvar "DIMLIM"    0)    ;; 0              ;;Generate dimension limits 0 - Off 1 - On
  (setvar "DIMLTEX1" "BYBLOCK")    ;;  "."    ;;Linetype extension line 1
  (setvar "DIMLTEX2" "BYBLOCK")    ;;  "."    ;;Linetype extension line 2
  (setvar "DIMLTYPE" "BYBLOCK")    ;;  "."    ;;Dimension linetype
;  (setvar "DIMLUNIT"  2)    ;; 2              ;;Dimension Units (except angular) - number type
;  (setvar "DIMLWD"   -2)    ;; -2             ;;Dimension Line Lineweights
;  (setvar "DIMLWE"   -2)    ;; -2             ;;Extension Line Line Weight
;;(setvar "DIMMZF")         ;;                ;;Sub-zero factor for metric dimensions - Unknown variable
;;(setvar "DIMMZS")         ;;                ;;Sub-zero suffix for metric dimensions - Unknown variable
;  (setvar "DIMPOST" "")     ;; ""             ;;Prefix and suffix for dimension text
;  (setvar "DIMRND"   0)     ;; 0              ;;Dimension Round distance to nearest n
;  (setvar "DIMSAH"   0)     ;; 0              ;;Separate arrow blocks 0 - Off 1 - On
;  (setvar "DIMSCALE" 1)     ;; 1              ;;Dimension Scale Factor
;  (setvar "DIMSD1"   0)     ;; 0              ;;Suppress the first dimension line 0 - Off 1 - On
;  (setvar "DIMSD2"   0)     ;; 0              ;;Suppress the second dimension line 0 - Off 1 - On
;  (setvar "DIMSE1"   0)     ;; 0              ;;Suppress the first extension line 0 - Off 1 - On
;  (setvar "DIMSE2"   0)     ;; 0              ;;Suppress the second extension line 0 - Off 1 - On
;  (setvar "DIMSOXD"  0)     ;; 0              ;;Suppress outside dimension lines
;  (setvar "DIMTAD"   0)     ;; 0              ;;Dimension Text Vertical distance
;  (setvar "DIMTDEC"  4)     ;; 4              ;;Tolerance decimal places
;  (setvar "DIMTFAC"  1)     ;; 1              ;;Dimension text scale factor of fractions relative to text height
;  (setvar "DIMTFILL" 0)     ;; 0              ;;Text background enabled
;  (setvar "DIMTFILLCLR" 0)  ;; 0              ;;Text background color 0: ByLayer, 256 ByBlock
;  (setvar "DIMTIH"   0)     ;; 0              ;;Text inside extensions is horizontal 0 - Off 1 - On
;  (setvar "DIMTIX"   0)     ;; 0              ;;Place text inside extensions 0 - Off 1 - On
;  (setvar "DIMTM"    0)     ;; 0              ;;Dimension Minus tolerance distance when used with dimtol, or dimlim
;  (setvar "DIMTMOVE" 0)     ;; 0              ;;Text movement
;  (setvar "DIMTOFL"  0)     ;; 0              ;;Force line inside extension lines 0 - Off 1 - On
;  (setvar "DIMTOH"   1)     ;; 1              ;;Text outside horizontal 0 - Off 1 - On
;  (setvar "DIMTOL"   0)     ;; 0              ;;Tolerance dimensioning 0 - Off 1 - On
;  (setvar "DIMTOLJ"  1)     ;; 0              ;;Tolerance vertical justification
;  (setvar "DIMTP"    0)     ;; 0              ;;Dimension Plus tolerance distance when used with dimtol, or dimlim
;  (setvar "DIMTSZ" 0.00)    ;; 0              ;;Tick size
;  (setvar "DIMTVP" 0.00)    ;; 0              ;;Text vertical position
  (setvar "DIMTXSTY" FontName)     ;; Font    ;;Text style
  (setvar "DIMTXT" FontHeight)     ;; 0.18 / 2.5   ;;Dimension text Height
;;(setvar "DIMTXTDIRECTIONOff" 0)  ;;         ;;Dimension text direction 1 or 0 - NOT SURE IF THIS WORKS
;  (setvar "DIMTZIN"  8)     ;; 8              ;;Suppresses leading zeros in tolerance values
;  (setvar "DIMUPT"   0)     ;; 0              ;;User positioned text 0 - Off 1 - On
;  (setvar "DIMZIN"   8)     ;; 8              ;;Suppresses leading zeroes



;;Set Dimstyle named above to this list
  (setq dimstylelist (tableSearch "dimstyle"))
  (if (= (member DimStyleName dimstylelist) nil)
    (command "dimstyle" "s" DimStyleName)
    (command "dimstyle" "s" DimStyleName "Y")
  )

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...