+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    28

    Default Get measurement units???

    Registered forum members do not see this ad.

    I am making some routines in VBA

    I need to know the units of the drawings I recieve so I can setup the variables.

    I have found a class named AcMeasurementUnit but dont know how to retrieve the info in it.

    Please... help.

    thanks!
    Last edited by Andresig; 18th Jun 2009 at 10:21 pm. Reason: i didn't specify is for vba

  2. #2
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,798

    Default

    Are you maybe after something like this

    Code:
    (defun civ_units ()
    (SETQ ANGBASEE (GETVAR "ANGBASE"))
    (SETQ ANGDIRR (GETVAR "ANGDIR"))
    (SETQ LUNITSS (GETVAR "LUNITS"))
    (SETQ LUPRECC (GETVAR "LUPREC"))
    (SETQ AUNITSS (GETVAR "AUNITS"))
    (SETQ AUPRECC (GETVAR "AUPREC"))
    (SETVAR "LUNITS" 2)
    (SETVAR "ANGBASE" 0.0)
    (SETVAR "ANGDIR" 0)
    (SETVAR "LUPREC" 0)
    (SETVAR "AUNITS" 0)
    (SETVAR "AUPREC" 0)
    )
    (defun old_civ_units ()
    (SETVAR "LUNITS" lunitss)
    (SETVAR "ANGBASE" angbasee)
    (SETVAR "ANGDIR" angdirr)
    (SETVAR "LUPREC" luprecc)
    (SETVAR "AUNITS" aunitss)
    (SETVAR "AUPREC" auprecc)
    )
    probably will meet you needs may just need a few more variables.

  3. #3
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    XP Pro
    Computer:
    Dell
    CPU:
    Intel Xeon 2.13GHz
    RAM:
    2GB
    Graphics:
    NVIDA Quadro FX 580
    Monitor:
    DELL 23" & SAMSUNG 21"
    Discipline
    Electro/Mech
    dbroada's Discipline Details
    Occupation
    Design Engineer
    Discipline
    Electro/Mech
    Using
    Electrical 2013
    Join Date
    Nov 2005
    Location
    Sussex, UK
    Posts
    5,118

    Default

    how about
    Code:
    thisdrawing.GetVariable("lunits")
    and
    Code:
     
    thisdrawing.SetVariable "lunits",1
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson

    Dave

  4. #4
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540

    Default

    Thread moved in the VBA forum.
    Welcome Andresing!
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  5. #5
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    28

    Default

    YESS !!!
    Thanks guys!!!

  6. #6
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    28

    Default this is how I used the GetVariable("lunits")

    Registered forum members do not see this ad.

    Code:
        
    Dim MUnits As Integer
     
    MUnits = ThisDrawing.GetVariable("lunits")
     
     
     If MUnits = 2 Then
            MsgBox MUnits & " Drawing in Milimeters"
    Else
            MsgBox MUnits & " Drawing in Inches"
    End If
    Last edited by Andresig; 2nd Jul 2009 at 05:18 pm.

Similar Threads

  1. Angle Measurement
    By Dipali in forum AutoCAD General
    Replies: 5
    Last Post: 16th Oct 2008, 01:14 pm
  2. Mutiple line measurement
    By fiesta26 in forum AutoCAD Drawing Management & Output
    Replies: 20
    Last Post: 12th Jun 2008, 01:59 pm
  3. Dimension scale measurement incorrectly
    By Mortier in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 28th May 2008, 10:43 am
  4. how to know what unit of measurement I'm using?
    By 13tildawn in forum AutoCAD Beginners' Area
    Replies: 11
    Last Post: 31st Mar 2008, 12:50 am
  5. Hatch Measurement
    By sendoor in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 9th Dec 2007, 04:57 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts