<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: vla-InsertBlock method applies unit scaling twice? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869180#M167583</link>
    <description>&lt;P&gt;here's an option assuming the drawing is already a block in the current dwg:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun get_blk_unt (blknam)
 (vlax-get-property (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blknam) "Units")
) &lt;/LI-CODE&gt;&lt;P&gt;Use the above function passing the block name to get the block definition to find the block's unit and then you insert the block in the dwg.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Oct 2025 02:02:48 GMT</pubDate>
    <dc:creator>paullimapa</dc:creator>
    <dc:date>2025-10-28T02:02:48Z</dc:date>
    <item>
      <title>vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13867980#M167562</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a routine where I'm inserting blocks based on text content. The blocks come from external .dwg files as well as possible block definitions already inside the drawing.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;While the main drawing is in meters (doesn't matter really) the block definitions can be defined in meters, millimeters, centimeters, ... the works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the vla-InsertBlock method to insert the blocks on the position of the text, with the text's rotation. But if a block definition has different units than the active drawing, then the block gets inserted with an added scale factor to compensate for the different units.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;rec= block 1000x1000 mm (1x1 meter) - defined in mm&lt;/P&gt;&lt;P&gt;target dwg= units=meter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(vla-InsertBlock ModelSpace (vlax-3d-point '(0 0 0) ) "rec" 1 1 1 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The block "rec" will be placed with both the Unit factor 0.001 and the scale xyz 1000. The latter should be 1. This results in a block that is a square km instead of a square m.&lt;BR /&gt;&lt;BR /&gt;Anybody knows how to prevent this, taking into account that I don't know beforehand whether the block or dwg I'm inserting has matching units to the target dwg?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MichielValcke_0-1761555419092.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1582182i09941127BA70D51E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MichielValcke_0-1761555419092.png" alt="MichielValcke_0-1761555419092.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 09:02:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13867980#M167562</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-27T09:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868102#M167565</link>
      <description>&lt;P&gt;Perhaps try prior to insert set these to 0 first&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INSUNITSDEFSOURCE,&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;INSUNITSDEFTARGET &lt;/STRONG&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;INSUNITS &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Blocks-xrefs-or-raster-images-are-scaled-when-inserted.html" target="_blank"&gt;https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Blocks-xrefs-or-raster-images-are-scaled-when-inserted.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 10:52:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868102#M167565</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-27T10:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868119#M167566</link>
      <description>&lt;P&gt;I looked into that, but the issue is that I don't know beforehand if the .dwg I'm inserting needs to be scaled or not. If I set it all to 0. Then the actual scale will be set to 1 (which is good) but in the case my source .dwg is in mm and my target in meter, then the block unit factor will also be 1 instead of 0.001 (which is bad).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I thought that relying on the correct application of the unit scale factor by AutoCAD I would get the correct block unit factor and by setting the scale to 1 1 1 with vla-insertblock the actual scale would be set to one. But somehow the actual scale gets set to 1000?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 11:19:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868119#M167566</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-27T11:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868461#M167572</link>
      <description>&lt;P&gt;Any difference if you use the actual Insert command to bring in the mm block into your Meter dwg?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 14:46:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868461#M167572</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-27T14:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868482#M167574</link>
      <description>&lt;P&gt;yes, when using (command "-insert" "rec" '(0 0 0) 1 1 0) - a regular block will insert correctly, but using that code a block with attributes will throw up the 'fill in attributes' dialog box and halt the routine. If I try to insert the block with (entmake ...) I need to be able to determine beforehand if there are attributes or not, which I don't know how to do from external .dwg's. If I presume there are no attributes, the blockdefinitions will enter 'broken' and need attsync's before they are fully functional again. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;so the vla-insertblock looked like the most promising method. In theory I could try and check the scale and rescale the block after insertion, but that is something I would like to avoid if possible. Preferably by knowing if there is a part of the method I'm not correctly using. My second preferred option would be to know if there is a system variable that I could set before and after the routine. Scaling block inserts after insertion, would be my last fix &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So far I haven't found anything by myself to help me for the first two options. So I'm putting it here before trying the last option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 15:01:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868482#M167574</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-27T15:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868528#M167575</link>
      <description>&lt;P&gt;This is an example excerpt from vlax-dump-object on the block in the above demo .dwg&lt;BR /&gt;&lt;BR /&gt;Application (RO) = #&amp;lt;VLA-OBJECT IAcadApplication 00007ff6663b2cc0&amp;gt;&lt;BR /&gt;; Document (RO) = #&amp;lt;VLA-OBJECT IAcadDocument 000001d3e1e67a78&amp;gt;&lt;BR /&gt;; EffectiveName (RO) = "rec"&lt;BR /&gt;; EntityTransparency = "ByLayer"&lt;BR /&gt;; Handle (RO) = "2FD"&lt;BR /&gt;; HasAttributes (RO) = 0&lt;BR /&gt;; HasExtensionDictionary (RO) = 0&lt;BR /&gt;; Hyperlinks (RO) = #&amp;lt;VLA-OBJECT IAcadHyperlinks 000001d3de4ec6e8&amp;gt;&lt;BR /&gt;; InsertionPoint = (0.0 0.0 0.0)&lt;BR /&gt;; InsUnits (RO) = "Millimeters"&lt;BR /&gt;; InsUnitsFactor (RO) = 0.001&lt;BR /&gt;; IsDynamicBlock (RO) = 0&lt;BR /&gt;; Layer = "0"&lt;BR /&gt;; Linetype = "ByLayer"&lt;BR /&gt;; LinetypeScale = 1.0&lt;BR /&gt;; Lineweight = -1&lt;BR /&gt;; Material = "ByLayer"&lt;BR /&gt;; Name = "rec"&lt;BR /&gt;; Normal = (0.0 0.0 1.0)&lt;BR /&gt;; ObjectID (RO) = 42&lt;BR /&gt;; ObjectName (RO) = "AcDbBlockReference"&lt;BR /&gt;; OwnerID (RO) = 43&lt;BR /&gt;; PlotStyleName = "ByLayer"&lt;BR /&gt;; Rotation = 0.0&lt;BR /&gt;; TrueColor = #&amp;lt;VLA-OBJECT IAcadAcCmColor 000001d3de71fd80&amp;gt;&lt;BR /&gt;; Visible = -1&lt;BR /&gt;; XEffectiveScaleFactor = 1000.0&lt;BR /&gt;; XScaleFactor = 1.0&lt;BR /&gt;; YEffectiveScaleFactor = 1000.0&lt;BR /&gt;; YScaleFactor = 1.0&lt;BR /&gt;; ZEffectiveScaleFactor = 1000.0&lt;BR /&gt;; ZScaleFactor = 1.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now that I look at the difference between the EffectiveScaleFactor, the regular ScaleFactor and the InsUnitsFactor. I think I have figured it out and don't see a way around it. The vla-insertblock method probably takes what it receives as a scale to be the regular scalefactor, Autocad determines the InsUnitsFactor and then the method recalculates the EffectiveScaleFactor so that the regular ScaleFactor can be maintained &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I guess I'll have to look at a different kind of solution&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264"&gt;@paullimapa&lt;/a&gt;&amp;nbsp;do you know a way to get the units from a .dwg if you only have the filename (full url) and it is not the active .dwg?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 15:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868528#M167575</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-27T15:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868617#M167576</link>
      <description>&lt;P&gt;Usually these are the setvar I do prior to block insert to handle blocks with attributes&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setvar "attreq" 0) ; disables request to enter values
(setvar "attdia" 0) ; disables dialog
(setvar "osnapcoord" 1) ; overrides running osnaps&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Oct 2025 16:04:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13868617#M167576</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-27T16:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869057#M167581</link>
      <description>&lt;P&gt;Thx&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1137264"&gt;@paullimapa&lt;/a&gt;&amp;nbsp; I forgot about attreq. I'll try to see if I can work with it and change the routine to fit it, otherwise I'll do a scale check after insertion and rescale if necessary&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 22:21:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869057#M167581</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-27T22:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869063#M167582</link>
      <description>&lt;P&gt;You are welcome…cheers!!!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 22:26:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869063#M167582</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-27T22:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869180#M167583</link>
      <description>&lt;P&gt;here's an option assuming the drawing is already a block in the current dwg:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun get_blk_unt (blknam)
 (vlax-get-property (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blknam) "Units")
) &lt;/LI-CODE&gt;&lt;P&gt;Use the above function passing the block name to get the block definition to find the block's unit and then you insert the block in the dwg.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 02:02:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869180#M167583</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-28T02:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869823#M167590</link>
      <description>&lt;P&gt;that is a nice and concise way, and I'll be able to use in one of the conditionals of the routine, for the blocks being inserted from an external .dwg I'll have to scale after insertion. I think that will be the cleanest solution.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 11:58:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13869823#M167590</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-28T11:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13870303#M167600</link>
      <description>&lt;P&gt;use the following code to get the units of a block from another dwg:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; get_odbx_blk_unt get unit of block inside another dwg
; Arguments:
; dwgnam = drawing name
; blknam = block name
; Example:
; (get_odbx_blk_unt "C:\\Users\\PauLpc\\Downloads\\SQ.dwg" "Test")
(defun get_odbx_blk_unt (dwgnam blknam / oDBX uni)
 (vl-load-com)
 (if 
   (vl-catch-all-error-p 
     (setq oDBX
      (vl-catch-all-apply 'vla-getinterfaceobject
       (list (vlax-get-acad-object)
        (if (&amp;lt; (setq oVer (atoi (getvar 'acadver))) 16)
           "objectdbx.axdbdocument"
           (strcat "objectdbx.axdbdocument." (itoa oVer))
        )
       )
      )
     )
   )
   (progn
     (princ "\nUnable to interface with ObjectDBX.")
     (setq oDBX nil)
   )
   (progn 
     (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-open (list odbx dwgnam)))
      (princ (strcat "\nError Opening Drawing: " dwgnam))
       (progn
        (setq uni (vlax-get-property (vla-item (vla-get-Blocks oDBX) blknam) "Units"))
       )
     )
     (vlax-release-object oDBX) 
   )
  ) ; if
 uni
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Oct 2025 16:12:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13870303#M167600</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-28T16:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13871278#M167623</link>
      <description>&lt;P&gt;This is beautiful, thank you so much.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2025 08:00:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13871278#M167623</guid>
      <dc:creator>Michiel.Valcke</dc:creator>
      <dc:date>2025-10-29T08:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: vla-InsertBlock method applies unit scaling twice?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13871394#M167625</link>
      <description>&lt;P&gt;You are welcome and as long as you’re running AutoCAD 2021 and up that’s the perfect time to use the -InsertContent command:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-B5D64510-561E-4FA9-8AD6-625445CCD81F" target="_blank"&gt;https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-B5D64510-561E-4FA9-8AD6-625445CCD81F&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2025 09:26:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-insertblock-method-applies-unit-scaling-twice/m-p/13871394#M167625</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2025-10-29T09:26:49Z</dc:date>
    </item>
  </channel>
</rss>

