Results 1 to 2 of 2

Thread: LISP that scales block on insert based on INSUNITS no longer working in 2018

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default LISP that scales block on insert based on INSUNITS no longer working in 2018

    Hi gang,

    I've been using the code below to insert blocks from our tool palettes. It basically reads INSUNITS of the current drawing and scales the block accordingly so that I can use one set of blocks in drawings with differing units. This is because (at least in 2016) blocks inserted from the tool palette did not honor differences in INSUNITS between source drawing and current drawing). Grrrr...

    Now, in AutoCAD 2016, it worked PERFECTLY. Inches, Feet, Millimeters, Meters, Paperspace or Modelspace, the single block was always scaled properly on insertion.

    We have now switched to AutoCAD 2018 and it no longer works properly, at least not in paperspace, in drawings where INSUNITS = 6 (METERS). In Inches and Millimeters drawings it's working fine.

    The blocks do report that they are inserted at the correct scale (for example in a DWG where UNITS is METERS the blocks are all scaled by 0.0254). And in fact in a scaled viewport, they look correct. But when inserted in PAPERSPACE they are 1000 times too small even though their scale in the properties palette still reports 0.0254. ???

    I have to scale them up manually by 1000 (to 25.4) for them to match the ones scaled to 0.0254 in the viewport. Here's an example:

    In the example, INSUNITS is set to 6 (METERS)
    On the right is a viewport scaled to 1:1 with the block in it. The block is scaled to 0.0254 and displaying as expected
    On the left is the block inserted using the same code but inserted into paperpsace. It's scale also reports 0.0254 but as you can see, it's 1000x too small (I've had to select it so you can even see it).



    Here's the code (thanks to many folks over a lot of time for their help with it.. BlackBox, Lee Mac, eh... forgetting a few I'm sure. Sorry)

    Any help is appreciated, as alwasy.

    Code:
    ;****TESTINSERT****
    (defun TESTINSERT( / CL SCL DBX )
    (setq CL (getvar "CLAYER"))
    (command "_.-Layer" "m" "L-ANNO-SYMB" "c" "3" "L-ANNO-SYMB" "")
    (cond ((= (getvar "INSUNITS") 1) (setq SCL 1))
          ((= (getvar "INSUNITS") 2) (setq SCL 0.08333))
          ((= (getvar "INSUNITS") 4) (setq SCL 25.4))
          ((= (getvar "INSUNITS") 5) (setq SCL 2.54))
          ((= (getvar "INSUNITS") 6) (setq SCL 0.0254))
          (t (alert "Current DWG set to non-standard units.  Check UNITS settings"))
    )
    
    
    (defun open_dbx (dwg / dbx)
       (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
          (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument"))
          (setq dbx (vlax-create-object
          (strcat "ObjectDBX.AxDbDocument."
             (substr (getvar "ACADVER") 1 2)
             )
          )
       )
    )
    (vla-open dbx dwg)
    dbx
    )
    (setq Dbx (open_dbx "Z:/AutoCAD 2018/Drawings/MVVA Callouts r30.dwg"))
    (vla-CopyObjects
    Dbx
    (vlax-safearray-fill
    (vlax-make-safearray vlax-vbObject '(0 . 0))
    (list (vla-item (vla-get-blocks dbx) "Detail Bubble Leaderless r30"))
    )
    (vla-get-blocks
    (vla-get-activedocument (vlax-get-acad-object))
    )
    )
    (vlax-release-object dbx)
    
    
    (command "-insert" "Detail Bubble Leaderless r30" "Scale" SCL PAUSE "0")
    
    
    (setvar "CLAYER" CL)
    (princ)
    )
    Attached Images Attached Images
    Last edited by jpcadconsulting347236; 2018-03-16 at 07:28 PM. Reason: Additional clarification and info.

  2. #2
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: LISP that scales block on insert based on INSUNITS no longer working in 2018

    OK, I think this is my issue... in the METERS template the annotation scale "1:1" is set to "1 paper unit = 0.001 drawing units" and I can't edit it.

    If I rename it to "OLD" and make a new "1:1" that is "1 paper unit = 1 drawing units" then the result is that the current annotation scale in paperspace is "OLD" and as far as I can tell, there is no way to set the cannoscale in paperpspace.

    ???

    Screen Shot 2018-03-16 at 3.40.03 PM.png

Similar Threads

  1. 2018: New INSUNITS variable in C3D 2018 - anyone else see the danger here?
    By kwoodward in forum AutoCAD Civil 3D - General
    Replies: 6
    Last Post: 2017-09-29, 02:08 PM
  2. 2015: Std ribbon, Home tab, Block, Insert - Thumbnails no longer appear
    By ralph.tulis in forum AutoCAD General
    Replies: 5
    Last Post: 2015-05-13, 06:39 PM
  3. Replies: 1
    Last Post: 2015-03-19, 02:55 PM
  4. Insert specific block based on user criteria
    By jimlapier in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-21, 07:41 PM
  5. LISP Block Insert routine no longer works once a parameter is modified
    By JAC.95598 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2005-11-22, 04:50 AM

Posting Permissions

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