Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Visual LISP, AutoLISP and General Customization
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

How to get the dim scale with lisp

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Wheelie22
1596 Views, 2 Replies

How to get the dim scale with lisp

I use this list :

((1000 . "DSTYLE") (1002 . "{") (1070 . 144) (1040 . -2.0) (1070 . 40) (1040 . 1.0) (1002 . "}"))

some times the first 1040 is the actual scale, but some times its the second

((1000 . "DSTYLE") (1002 . "{") (1070 . 144) (1040 . 5.0) (1070 . 40) (1040 . 1.0) (1070 . 43) (1040 . 5.0) (1002 . "}"))

some times it is in there 3 times ? Smiley Surprised

 

but the CRTL-1 window has the right 1

 

dim scale.png

How do i know where the scale is ?

 

 

Tags (4)
2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: Wheelie22

I believe it's the 1040 entry that immediately follows  (1070 . 144).

Kent Cooper, AIA
Message 3 of 3
ambrosl
in reply to: Kent1Cooper

I believe Kent is correct, but you might be able to eliminate the guess work though if you use the following AutoLISP functions which allow you to move away from needing to dig through the DXF code groups:

 

  • getpropertyvalue
  • setpropertyvalue
  • dumpallproperties

The above functions take Dimension Overrides into consideration and will return that value rather than the base dimension style when they are applied.

 

DUMPALLPROPERTIES returns a list of the properties that apply to a specific entity.

 

Begin dumping object (class: AcDbRotatedDimension)
...
Dimgap (type: double)  (LocalName: Text offset) = 0.090000
Dimjust (type: DimHorizontalTextPosEnum)  (LocalName: Text pos hor) = 0
Dimldrblk (type: AcDbObjectId) = 0
Dimlfac (type: double)  (LocalName: Dim scale linear) = 1.000000
Dimlim (type: bool) = 0
Dimltex1 (type: AcDbObjectId)  (LocalName: Ext line 1 linetype) = 2a235140
Dimltex2 (type: AcDbObjectId)  (LocalName: Ext line 2 linetype) = 2a235140
Dimltype (type: AcDbObjectId)  (LocalName: Dim line linetype) = 2a235140
...
End object dump

When you have the property name and the entity, you can then get or set the property value.

 

(setq ent (car (entsel)))
(getpropertyvalue ent "Dimlfac")

Using the GETPROPERTYVALUE and SETPROPERTYVALUE functions are much easier than sifting through DXF code values, habits are hard to break even I gravitate to DXF codes yet, and using those functions does require less code in the end.  The functions were introduced back in AutoCAD 2011, so they have been around for a while unless you need to support AutoCAD 2010 or earlier then you would need to continue using the DXF code values directly.

 

Best of luck finishing your code.



Lee Ambrosius
Senior Principal Content Experience Designer
For additional help, check out the AutoCAD Developer Documentation

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report