Author Topic: Get Properties of non-uniformly scalled blocks  (Read 3577 times)

0 Members and 1 Guest are viewing this topic.

artisteroi

  • Guest
Re: Get Properties of non-uniformly scalled blocks
« Reply #15 on: July 01, 2010, 11:04:47 AM »
Oleg,
Would you want to make a small adjustment to this code for me? The output file only has 1 decimal place in the cells. can that be changed to 4 decimal places. I tried to do it myself but couldn't figure it out. Any help would be appreciated. Below is the one I am using.

Code: [Select]
(vl-load-com)
;;==============================================;;

(defun C:BCSV (/ *error* datafile data_line en filename obj sset)

  (defun *error* (msg)
    (if datafile (close datafile))
    (if msg (princ (strcat "\nError! " msg)))
    (princ)
    )
 
(setq filename (strcat (getvar "dwgprefix")
      (vl-filename-base (getvar "dwgname"))".csv")
)

  (command "._zoom" "_e")
  (if
    (setq sset (ssget "X" (list (cons 0 "INSERT")(cons 410 (getvar "CTAB")))))
     (progn
       (setq part (getstring T "\nProduct Code: "))
       (setq fact (getstring T "\nManufacturer : "))
       (setq datafile (open filename "A"))
       

       (while (setq en (ssname sset 0))
       (setq obj (vlax-ename->vla-object en))
  (setq data_line (strcat part ","
  fact ","
  (vlax-get-property obj 'EffectiveName) ","
  (rtos (car (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (cadr (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (caddr (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (vlax-get-property obj 'XScaleFactor) 2 1) ","
  (rtos (vlax-get-property obj 'YScaleFactor) 2 1) ","
  (rtos (vlax-get-property obj 'ZScaleFactor) 2 1) ","
  (vla-get-layer obj)))
 
  (write-line data_line datafile)
  (ssdel en sset)
  )
       
       (close datafile)

       )
     )
(command "._zoom" "_p")
  (princ)
  )
   
(prompt "\nStart command with BCSV")
(prin1)
 

artisteroi

  • Guest
Re: Get Properties of non-uniformly scalled blocks
« Reply #16 on: July 01, 2010, 04:36:25 PM »
never mind I figured it out. (WOO HOO)

Code: [Select]
  (rtos (car (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (cadr (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (caddr (vlax-get obj 'InsertionPoint)) 2 3) ","
  (rtos (vlax-get-property obj 'XScaleFactor) 2 1) ","
  (rtos (vlax-get-property obj 'YScaleFactor) 2 1) ","
  (rtos (vlax-get-property obj 'ZScaleFactor) 2 1) ","

the last set of digits in these lines control the decimal places. I changed the 3 and ones to 4. works fine now

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Get Properties of non-uniformly scalled blocks
« Reply #17 on: July 01, 2010, 04:40:17 PM »
Watch out for the the effective scale factor.

Code: [Select]
;   XEffectiveScaleFactor = 1.0
;   XScaleFactor = 1.0
;   YEffectiveScaleFactor = 1.0
;   YScaleFactor = 1.0
;   ZEffectiveScaleFactor = 1.0
;   ZScaleFactor = 1.0
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

artisteroi

  • Guest
Re: Get Properties of non-uniformly scalled blocks
« Reply #18 on: July 01, 2010, 04:42:44 PM »
ahhh! dont confuse me!

It's working, thats all that counts