Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Entmake Insert with Annotative Scale

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mpalan2009
655 Views, 2 Replies

Entmake Insert with Annotative Scale

I would like to make this function work without the use of the command function below.  Is there a way to do what this commmand is doing programmatically. I don't even know where to begin to figure this out.

 

(command "._ObjectScale" (entlast) "" "Add" (getvar "CANNOSCALE") "")

 

 

; this function is very crude as I'm still working out how to accomplish this.

(defun Block_DEF ()
(entmake (LIST '(0 . "BLOCK")'(8 . "0")(CONS 2 "TAG_NOT6")'(66 . 1)'(70 . 2)'(10 0.0 0.0 0.0)))
;Entmake a lwpolyline - PG generates a list of points around a circle of a supplied rad.
(lwpl (pg "6" '(0.0 0.0 0.0) 0.15625) "0" "bylayer" 256)
;Entmake an attribute definition
(ENT_ATDEF (LIST "VALUE" "TAG2" '(0 0 0) '(0 0 0) 0.1666 "standard" 1 2) 0 1 "bylayer")
(entmake '((0 . "ENDBLK")))
; makes the block reference annotative - by Lee Mac
((lambda ( lst )(regapp "ACAD")(regapp "AcadAnnotative")
    (entmod (append (subst (cons 70 1) (assoc 70 lst) lst)
       (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{")(cons 1070 1)(cons 1070 1)(cons 1002 "}"))
             (list "AcadAnnotative" (cons 1000 "AnnotativeData") (cons 1002 "{")(cons 1070 1)(cons 1070 1)(cons 1002 "}"))  )))))
    (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "TAG_NOT6"))))) )

(entmake (list '(0 . "INSERT") (cons 8 "0") '(66 . 1) (CONS 2 "TAG_NOT6")(CONS 41 1.0)(CONS 42 1.0)(CONS 43 1.0)(CONS 50 0.0)(cons 10 '(0.0 0.0 0.0))) )
 ;Entmake an attribute definition
(ENT_ATRIB (LIST (GETSTRING T "\nEnter Tag Designation: ") "TAG" '(0.0 1.0 0.0) '(0.0 0.0 0.0) (* 0.09375 1.0) "standard" 1 2) 0 256 "bylayer")
(Entmake (list '(0 . "SEQEND")(cons 8 "0")))


(command "._ObjectScale" (entlast) "" "Add" (getvar "CANNOSCALE") "")
(princ))

 

 

Thanks for your help.

Matthew

2 REPLIES 2
Message 2 of 3
mpalan2009
in reply to: mpalan2009

The command above will not work in paperspace.  I have found a way to get it done, and I thought I would share it.

 

    (SETQ VLATMP (vla-insertblock ((if (eq (getvar "cvport") 1) vla-get-paperspace vla-get-modelspace) (vla-get-ActiveDocument (vlax-get-acad-object)))
                                   (vlax-3d-point Pt) NamePart 1.0 1.0 1.0 Rot))

 

hope this helps

Mathew

Message 3 of 3
CincyJeff
in reply to: mpalan2009

This might work for you, however it uses visual lisp.

(defun Block_DEF ()
(entmake (LIST '(0 . "BLOCK")'(8 . "0")(CONS 2 "TAG_NOT6")'(66 . 1)'(70 . 2)'(10 0.0 0.0 0.0)))
;Entmake a lwpolyline - PG generates a list of points around a circle of a supplied rad.
(lwpl (pg "6" '(0.0 0.0 0.0) 0.15625) "0" "bylayer" 256)
;Entmake an attribute definition
(ENT_ATDEF (LIST "VALUE" "TAG2" '(0 0 0) '(0 0 0) 0.1666 "standard" 1 2) 0 1 "bylayer")
(entmake '((0 . "ENDBLK")))
; makes the block reference annotative - by Lee Mac
((lambda ( lst )(regapp "ACAD")(regapp "AcadAnnotative")
    (entmod (append (subst (cons 70 1) (assoc 70 lst) lst)
       (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{")(cons 1070 1)(cons 1070 1)(cons 1002 "}"))
             (list "AcadAnnotative" (cons 1000 "AnnotativeData") (cons 1002 "{")(cons 1070 1)(cons 1070 1)(cons 1002 "}"))  )))))
    (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "TAG_NOT6"))))) )

(entmake (list '(0 . "INSERT") (cons 8 "0") '(66 . 1) (CONS 2 "TAG_NOT6")(CONS 41 1.0)(CONS 42 1.0)(CONS 43 1.0)(CONS 50 0.0)(cons 10 '(0.0 0.0 0.0))) )
 ;Entmake an attribute definition
(ENT_ATRIB (LIST (GETSTRING T "\nEnter Tag Designation: ") "TAG" '(0.0 1.0 0.0) '(0.0 0.0 0.0) (* 0.09375 1.0) "standard" 1 2) 0 256 "bylayer")
(Entmake (list '(0 . "SEQEND")(cons 8 "0")))

(vl-load-com)
(vla-put-xeffectivescalefactor (vlax-ename->vla-object (entlast)) (getvar "cannoscalevalue"))
(vla-put-yeffectivescalefactor (vlax-ename->vla-object (entlast)) (getvar "cannoscalevalue"))
(vla-put-zeffectivescalefactor (vlax-ename->vla-object (entlast)) (getvar "cannoscalevalue"))
;(command "._ObjectScale" (entlast) "" "Add" (getvar "CANNOSCALE") "")
(princ))

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost