Author Topic: Variable  (Read 1899 times)

0 Members and 1 Guest are viewing this topic.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Variable
« on: September 01, 2016, 07:00:00 PM »
Is there another variable I can use to get a drawing scale other than dimscale?

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Variable
« Reply #1 on: September 01, 2016, 07:12:51 PM »
Do you mean to "set" a drawing scale? If so, then it would be text height, linetype scale.
HTH

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Variable
« Reply #2 on: September 01, 2016, 07:15:28 PM »
There is no "drawing scale variable" as such, so the ye olde tradition has been to use the current DIMSCALE system variable.  You could add an Extension dictionary/XRecord to the document, or the model space container, which contains scale information.  You should also be able to create a custom system variable; I know it can be done with dotNET but haven't tried manual creation of the registry entries yet.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Variable
« Reply #3 on: September 01, 2016, 09:02:34 PM »
Depends what you mean by scale.

In my world it means the ratio of paper space to model space.

Accordingly, you could examine the CustomScale property of non tiled viewports.

Quick & dirty for fun:

Code: [Select]
(defun c:WMS ( / ss i scale result ) ;; wuts my scale?
    (princ "\nScale: ")
    (if (setq ss (ssget "x" '((0 . "viewport")(-4 . "!=")(69 . 1))))
        (progn
            (repeat (setq i (sslength ss))
                (or
                    (member
                        (setq scale
                            (/
                                1.0
                                (vla-get-customscale
                                    (vlax-ename->vla-object (ssname ss (setq i (1- i))))
                                )
                            )
                        )
                        result
                    )
                    (setq result (cons scale result))
                )
            )
            (princ
                (if (eq 1 (length result))
                    (car result)
                    (strcat "multiples exist " (vl-princ-to-string (vl-sort result '<)))
                )
            )
        )
        (princ "unknown")
    )
    (princ)
)

WMS
Scale: 50.0

<different drawing>
WMS
Scale: multiples exist (50.0 200.0)

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: Variable
« Reply #4 on: September 02, 2016, 02:15:55 AM »
Thanks all :)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Variable
« Reply #5 on: September 02, 2016, 02:40:57 AM »
There's also CAnnoScale (Current Annotative Scale) and CAnnoScaleValue - if your drawing uses annotative scaling. Not to mention, objects could then also have one or more annotative scales attached as extension dictionaries.

Otherwise a "drawing" (especially its model space) is actually in 1:1 scale ... or should be. And as MP shows, the viewport defines the scale (or the plot setting if you print directly from model space). The DimScale is simply a setting of the current DimStyle, it may even not be used (e.g. if the DimStyle is set to auto-adjust to viewport scale, DimScale=0.0).

If you do set DimScale relevant to whatever the drawing is, chances are that you did something similar to LTScale as well - i.e. line type dash lengths should equally scale depending on the printed scaling. But similarly it could adjust per viewport if your PSLTScale is set to 1. Same goes for text heights and the TextSize variable.

E.g. going through the ACad documentation
I'd really advise you look through System Variables, perhaps use the search function there to find everything related to scales.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

PKENEWELL

  • Bull Frog
  • Posts: 319
Re: Variable
« Reply #6 on: September 06, 2016, 04:35:13 PM »
If you are trying to determine the drawing units - what about the MEASUREMENT system Variable? I have effectively used this variable to determine if a drawing is in metric or imperial units.


MEASUREMENT (System Variable)

Controls whether the current drawing uses imperial or metric hatch pattern and linetype files.

Type:   Integer
Saved in:   Drawing
Initial value:   0 (imperial) or 1 (metric)

Imperial; uses the hatch pattern file and linetype file designated by the ANSIHatch and ANSILinetype registry settings

Metric; uses the hatch pattern file and linetype file designated by the ISOHatch and ISOLinetype registry settings
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt