Author Topic: Uniformly Scaled Drawings  (Read 1746 times)

0 Members and 1 Guest are viewing this topic.

Harrie

  • Guest
Uniformly Scaled Drawings
« on: February 14, 2011, 06:56:17 AM »
I know how I can see that the block reference is prevented from being non-uniformly scaled.
Code: [Select]
(defun IsUniform (BlockName /)
  (vl-load-com)
  (= acUniform
     (vla-get-blockscaling
       (vla-item (vla-get-blocks
  (vla-get-activedocument (vlax-get-acad-object))
)
BlockName
       )
     )
  )
)
When write such a block with the command WBLOCK to the harddisk,
how can I see that the drawing is prevented from being non-uniformly scaled.
Code: [Select]
(if Uniform (command "_.INSERT" BlockName pause "1" "0")
(command "_.INSERT" BlockName pause "1" "1" "0"))

Regards Harrie.
« Last Edit: February 14, 2011, 12:18:54 PM by Harrie »

HofCAD

  • Guest
Re: Uniformly Scaled Drawings
« Reply #1 on: February 14, 2011, 12:30:30 PM »
It is not elegant, but it works.
Code: [Select]
(defun c:InsBlk (/ @UFS BlockName ~Att)
  (defun @UFS (BlockName)
    (vl-load-com)
    (vla-get-BlockScaling
      (vla-item
(vla-get-blocks
 (vla-get-activedocument
   (vlax-get-acad-object)
 )
)
BlockName
      )
    )
  )
 (setq BlockName (getstring "\n Enter block name:"))
  (if (or (tblsearch "BLOCK" BlockName)
 (findfile (strcat BlockName ".dwg"))
      )
    (progn
      (setq ~Att (getvar "ATTREQ"))
      (setvar "ATTREQ" 0)
      (command "_.INSERT" BlockName)
      (command);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;not elegant
      (If (= (@UFS BlockName) 1)
(command "_.INSERT" BlockName pause "1" "0")
(command "_.INSERT" BlockName pause "1" "1" "0")
      )
      (setvar "ATTREQ" ~Att)
    )
    (princ (strcat "\nFile " BlockName ".dwg is not in search path."))
  )
  (princ)
)

Instead of the above @UFS you can use:

Code: [Select]
(defun @UFS (BlockName)
  (cdr
    (assoc 281
  (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" BlockName))))
  )
    )
  )
)

HofCAD CSI


« Last Edit: February 14, 2011, 12:35:17 PM by HofCAD »