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

DIMSCALE Linear Routine

6 REPLIES 6
Reply
Message 1 of 7
sovby
1057 Views, 6 Replies

DIMSCALE Linear Routine

We have dimensions in paperspace. The dim scale linear is "-48.00000000". I believe it is -48 because it is reading the viewport scale which is 1/4"=1'-0". Sometimes we find dimensions that have another dim linear scale & the dimensions are wrong. I believe this is happening from my coworkers copy clipping from other drawings. i probably wont be able to stop people from doing that so i was thinking i could create a lisp that loads upon opening of a drawing to check this variable & either alert the user that they have a bad dimension or fix it.  If i had a list of -24 for 1/2" scale, -48 for 1/4" etc. & then have the routine check for anything else. Any ideas? Can i isolate this variable like i am thinking? Is there a better way? I know some people like to have dimensions in model space. The reason we did this was to try to have less layers in our drawing but it has created other problems such as this one.

6 REPLIES 6
Message 2 of 7
Kent1Cooper
in reply to: sovby

That's the DIMLFAC [DIMension: Linear scale FACtor] System Variable.  I, too, keep Dimensions in model space at DIMLFAC = 1 except under a few peculiar circumstances, but the negative value means 1 is used in model space anyway, if you draw any Dimensions there, even with an absolute value other than one in the System Variable for paper space Dimensions.  Presumably you could have something find all linear varieties of Dimensions in paper space, check for their linear scale factor, if any [it's not in the entity data, but in either extended data or VLA Properties], and compare it to the current DIMLFAC setting.  Any that have a different value could be flagged [selected and highlighted, moved to a different Layer, or something], and an alert put up if any were found.  Does that sound worth pursuing?

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

Yeah. We have dimscale set to 1 & dimassoc set to 2. we create a new dimension in paperspace & pick the end point of something that is in modelspace. This gives me a dim scale linear setting of -48.00000001 for a viewport that is set at 1/4" scale. Sometimes i get -48 & sometimes a slightly different number. The problem comes when sometimes i find one that somebody copied from somewhere which may have a setting of something like -250 or some crazy number. The user is trying to dimension something that for instance in modelspace is 10'-0" & the dimension reads as something like 100'-0". My current dimlfac variable is set to 1 but the property of the dimension reads -48.00000001.

Message 4 of 7
Kent1Cooper
in reply to: sovby

Might you sometimes have paper space Viewports looking into model space at more than one scale in the same drawing file?  In such a case, linear-variety Dimensions drawn in paper space should have different linear scale factor overrides depending on the viewing scale of the viewport they're drawn over.  If DIMLFAC has one value for the entire drawing file, that would make it challenging to figure out a way to determine what it should be for a given Dimension, and therefore whether it's "wrong" and should be flagged.

Kent Cooper, AIA
Message 5 of 7
sovby
in reply to: Kent1Cooper

Yes we do. Thats why i was thinking if i had a list of various dimension overrides that are expected to be in the drawing then i could have a routine check the drawing & if it found something different it could alert the user. Eventually i could expand on it & maybe either highlight the dimension or have it zoom to the location but if i could at least have the alert that would help. For some reason the dimscale Linear overide shows -48.00000001 when i would think it would be -48.

Message 6 of 7
Kent1Cooper
in reply to: sovby

The (equal) function has a fuzz factor that will allow you to let the ones with the 10-to-the-minus-8-or-so variation "pass inspection" and not be flagged.  It makes the evaluation of individual Dimensions a little more complicated, though.  If there were never such tiny variations, you could find a Dimension's linear scale factor and then check whether it's in a list of valid values:

 

(if (member theScaleFactor '(24.0 48.0 96.0)); is it in list of valid values?

  (... then -- it's OK ...)

  (... else -- flag it ...)

); if

 

And you could use that, if you want the close ones to be made exact.  If it's not in the list, the routine could then check what the actual value is, and if it's close enough to a valid one, just round it to that, but if not, flag it for further consideration.

 

But if you want to leave the really-close ones as they are, using (equal) with a fuzz factor, you'd need to check against each possible valid value separately, this being one way:

(if

  (member T

    (mapcar ; makes list of nils with a T where it matches a valid value [if it does]

      '(lambda (x) (equal x theScaleFactor 1e-9))

      '(24.0 48.0 96.0); list of valid values

    ); mapcar

  ); member

  (... then -- it's OK ...)

  (... else -- flag it ...)

); if

 

Either way, if a Dimension has a factor [or close enough to one] that's in the list, but should have a different factor in the list [e.g. something drawn for 1/2" scale that has Dimensions for 1/4" scale], it won't be flagged by that approach.

Kent Cooper, AIA
Message 7 of 7
sovby
in reply to: Kent1Cooper

ok thanks. This gives me something to think about. It seems like this can be done. Now i guess its a matter of getting the code to work for me.

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

Post to forums  

Autodesk Design & Make Report

”Boost