Results 1 to 8 of 8

Thread: how to find unit type of dwg in lisp?

  1. #1
    100 Club jpduhon's Avatar
    Join Date
    2005-10
    Posts
    153
    Login to Give a bone
    0

    Default how to find unit type of dwg in lisp?

    How do i find the unit type of a drawing within lisp?

    Management wants me to force all drawings to the highest possible precision (1/256"). I figured the best way to do that was a simple command line in the acaddoc.lsp that resets the units. Problem is trying to set a metric drawing's precision to 256 doesn't work. How do I check the dwg unit type before running the command?

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    First of all I must tell you that I can nothing about the imperial unit system,
    and then I don't know if I can say that a model file has any unit, because you draw in vectors and a length is a length and a radius is a radius.
    But nowadays 2007 you can tell AutoCAD if your vector file is in metric, imperial or crazy more. . .
    Check the system variables :
    INSUNITS, INSUNITSDEFSOURCE and INSUNITSDEFTARGET
    When you use those system variables correct a metric millimetre model is correct scaled in to a model in metric meter or imperial feet or inch (or crazy more) when you insert a block or an xref.

    : ) Happy Computing !

    kennet

    BTW
    and than you have LUNITS that set linear units, and UNITMODE for Displays units
    Last edited by kennet.sjoberg; 2007-04-25 at 08:51 PM. Reason: BTW

  3. #3
    100 Club jpduhon's Avatar
    Join Date
    2005-10
    Posts
    153
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    Quote Originally Posted by kennet.sjoberg
    Check the system variables :
    INSUNITS, INSUNITSDEFSOURCE and INSUNITSDEFTARGET
    When you use those system variables correct a metric millimetre model is correct scaled in to a model in metric meter or imperial feet or inch (or crazy more) when you insert a block or an xref.

    : ) Happy Computing !

    kennet
    beautiful! that works. that's what i was looking for.

    I can just query the INSUNITS and if it = 1 then i'll run the command and set precision to 256 and if it = 4 i'll set it to 8. I'll probably have to post back to get someone to check my code before deploying it though.

    thanks kennet!

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    Quote Originally Posted by jpduhon
    beautiful! that works. that's what i was looking for.

    I can just query the INSUNITS and if it = 1 then i'll run the command and set precision to 256 and if it = 4 i'll set it to 8. I'll probably have to post back to get someone to check my code before deploying it though.

    thanks kennet!
    I am just glad to help,

    Here is something for your mind,
    do not forget that old models do not have the actual systemvariable set.
    do not forget that user must set the actual systemvariable.
    do not forget to reset the actual systemvariable if you scale the model.
    do not forget to . . .

    : ) Happy Computing !

    kennet

  5. #5
    100 Club jpduhon's Avatar
    Join Date
    2005-10
    Posts
    153
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    yeah, so i still need help. I thought this was going to be an easy one.

    what did i do wrong?
    Code:
    (setq What_Unit_Type (getvar INSUNITS))
    (if (= 1 What_Unit_Type) 
      (progn
    	(command "-units" "" "256" "1" "2" "0.00" "N")
      )  
    )
    it returns this:
    Code:
    error: bad 
    argument type: (or stringp symbolp): nil

  6. #6
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    Quote Originally Posted by jpduhon
    yeah, so i still need help. I thought this was going to be an easy one.

    what did i do wrong?
    Code:
    (setq What_Unit_Type (getvar "INSUNITS"))
    (if (= 1 What_Unit_Type) 
      (progn
    	(command "-units" "" "256" "1" "2" "0.00" "N")
      )  
    )
    added in red

    : ) Happy Computing !

    kennet

  7. #7
    100 Club jpduhon's Avatar
    Join Date
    2005-10
    Posts
    153
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    Quote Originally Posted by kennet.sjoberg
    Code:
    (setq What_Unit_Type (getvar "INSUNITS"))
     (if (= 1 What_Unit_Type) 
       (progn
     	(command "-units" "" "256" "1" "2" "0.00" "N")
       )  
     )
    added in red

    : ) Happy Computing !

    kennet
    D'oh!!!!!!!!
    Thanks much Kennet!!!!!

  8. #8
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: how to find unit type of dwg in lisp?

    Quote Originally Posted by jpduhon
    D'oh!!!!!!!!
    Thanks much Kennet!!!!!
    you are welcome.

    : ) Happy Computing !

    kennet

Similar Threads

  1. 2013 find out material type used
    By p.michell374679 in forum NavisWorks - General
    Replies: 1
    Last Post: 2013-05-01, 02:20 PM
  2. Type Catalog Unit - decimal_degrees
    By sthedens in forum Revit Architecture - Families
    Replies: 3
    Last Post: 2009-09-30, 01:08 PM
  3. scheduling unit groups by level/building type
    By heloisab in forum Revit Architecture - General
    Replies: 1
    Last Post: 2008-05-15, 11:10 AM
  4. Replies: 2
    Last Post: 2008-02-01, 09:05 PM
  5. Replies: 3
    Last Post: 2007-02-23, 02:50 PM

Posting Permissions

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