Code Red > AutoLISP (Vanilla / Visual)

Convert annotative blocks to normal blocks

(1/4) > >>

vnanhvu:
I use layout, I take annonative 100 (in properties )for in viewport scale 100 Only see. Same text, dim with annonative.
Can you help me, convert annotative blocks to normal blocks.
Thank you very much.

alanjt:

--- Code: ---Command:
CHANGE
Select objects: Specify opposite corner: 10 found

Select objects:
Specify change point or [Properties]: p

Enter property to change
[Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotati
ve]: a

Make Annotative? [Yes/No] <No>:

Enter property to change
[Color/Elev/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotati
ve]:
--- End code ---

ribarm:
Alan, neither of variations in this code won't work neither in Acad 2012 nor Acad 2011 nor Acad 2008...


--- Code: ---(defun c:t ( / ss ssent Block BlockName blocks ch)
  (vl-load-com)
  (prompt "\nSelect block")
  (setq ss (ssget ":S"))
  (setq ssent (ssname ss 0))
  (setq Block (vlax-ename->vla-object ssent))
  (setq BlockName (vla-get-effectivename Block))
  (setq blocks (vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object))
       )
  )
  (initget 1 "Annotative a Non-annotative n")
  (setq ch
(getkword
   "\nDo you want to make block Annotative or Non-annotative (A/N) : "
)
  )
  (vlax-for bl blocks
    (cond ((and (= (vla-get-name bl) BlockName) (= ch "Annotative"))
   ;(vla-put-Annotative bl :vlax-true)
           (command "change" ssent "" "P" "A" "Yes" "")
   )
  ((and (= (vla-get-name bl) BlockName) (= ch "Non-annotative"))
   ;(vla-put-Annotative bl :vlax-false)
   (command "change" ssent "" "P" "A" "No" "")
   )
    )
  )
  (princ)
)

--- End code ---

M.R. :-(

vnanhvu:
 Thanks Rebarm& Alanjt, but no result. Hix :cry:

ribarm:
Even worse... I tried to trick CAD (to explode block, delete, redefine it and if necessary insert with new Annotation value)... No success, for after explode, all subentities changed their entity names... Nothing gets selected from new selection set after explode...


--- Code: ---(defun listsubent (bname / data datalst)
(setq data (tblobjname "BLOCK" bname))
(setq data (entget data '("*")))
(setq data (acet-dxf -2 data))
(setq datalst (cons data datalst))
(setq data (entget data '("*")))
(while data
(setq data (entnext (acet-dxf -1 data)))
(if (/= data nil)
(progn
(setq datalst (cons data datalst))
(setq data (entget data '("*")))
))
)
(setq datalst (reverse datalst))
)

;(defun c:t ( / ss ssent blocks Block BlockName inspt rotang Xeffscf Yeffscf Zeffscf subentlst sssubents ch)
(defun c:t nil
  (vl-load-com)
  (prompt "\nSelect block")
  (setq ss (ssget ":S"))
  (setq ssent (ssname ss 0))
  (setq blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
  (setq Block (vlax-ename->vla-object ssent))
  (setq BlockName (vla-get-effectivename Block))
  (setq inspt (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint Block))))
  (setq rotang (vla-get-rotation Block))
  (setq Xeffscf (vla-get-Xeffectivescalefactor Block))
  (setq Yeffscf (vla-get-Yeffectivescalefactor Block))
  (setq Zeffscf (vla-get-Zeffectivescalefactor Block))
  (setq subentlst (listsubent BlockName)) 
  (setq sssubents (ssadd))
  (foreach sub subentlst
  (ssadd sub sssubents)
  )
  (vlax-for bl blocks
  (if (= (vla-get-name bl) BlockName)
  (vla-put-explodable bl :vlax-true)
  )
  )
;  (command "group" "" BlockName "" ssent "")
  (vla-explode Block)
  (vla-delete Block)
  (initget 1 "Annotative a Non-annotative n")
  (setq ch
(getkword
   "\nDo you want to make block Annotative or Non-annotative (A/N) : "
)
  )
  (if (= ch "Annotative") (setq ch "Yes"))
  (if (= ch "Non-annotative") (setq ch "No"))
;  (command "select" "g" BlockName "")
;  (setq sssubents (ssget "P"))
  (sssetfirst nil sssubents)
;  (command "block" BlockName "Y" "A" ch "" inspt sssubents "")
;  (command "insert" BlockName inspt Xeffscf rotang)
  (princ)
)

--- End code ---

M.R. Shit... :realmad:

Navigation

[0] Message Index

[#] Next page

Go to full version