Jump to content

Block edit & rotation lisp required


amb2301

Recommended Posts

Hi Friends,

I require a lisp file to convert the block to Text in required format(as shown in attached Picture). actually i have lots of blocks in my drawing,all to be converted to the below shown format, previous i am doing manually as in below shown steps

1. block edit

2. removing the cyan line & text below to it inside block editor,

3. changing the font height to 2.0 & style as Arial

4. exiting block editor

5. using ATTSYNC command to reflect the changes made in all blocks,

6. select simillar all blocks & making rotation to 0 degree.

 

Also attached .dwg with this, please help me.

 

Thanks,

Amb.

pic1.jpg

Annotation re-arrange.dwg

Link to comment
Share on other sites

(defun c:foo (/ a p s)
 (if (setq s (ssget '((0 . "insert") (2 . "SITE_ANNO") (66 . 1))))
   (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
     (and (setq p (cdr (assoc 10 (entget b))))
   (setq a (vl-some '(lambda (x)
		       (if (= "ADRESSE" (vla-get-tagstring x))
			 (vla-get-textstring x)
		       )
		     )
		    (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
	   )
   )
   (entmake (list '(0 . "TEXT")
		  '(100 . "AcDbEntity")
		  '(67 . 0)
		  '(8 . "SITE_ANNO")
		  '(62 . 1)
		  '(6 . "ByBlock")
		  '(100 . "AcDbText")
		  (cons 10 p)
		  '(40 . 2.0)
		  (cons 1 a)
		  '(50 . 0.0)
		  '(41 . 1.0)
		  '(51 . 0.0)
		  '(7 . "Style-Arial")
		  '(71 . 0)
		  '(72 . 1)
		  (cons 11 p)
		  '(100 . "AcDbText")
		  '(73 . 0)
	    )
   )
   (entdel b)
     )
   )
 )
 (princ)
)

Edited by ronjonp
Link to comment
Share on other sites

(defun c:foo (/ a p s)
 (if (setq s (ssget '((0 . "insert") (2 . "SITE_ANNO") (66 . 1))))
   (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
     (progn (setq p (cdr (assoc 10 (entget b))))
     (setq a (vl-some '(lambda (x)
			 (if (= "ADRESSE" (vla-get-tagstring x))
			   (vla-get-textstring x)
			 )
		       )
		      (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
	     )
     )
     (if (entmake (list	'(0 . "TEXT")
			'(100 . "AcDbEntity")
			'(67 . 0)
			'(8 . "SITE_ANNO")
			'(62 . 1)
			'(6 . "ByBlock")
			'(100 . "AcDbText")
			(cons 10 p)
			'(40 . 2.0)
			(cons 1 a)
			'(50 . 0.0)
			'(41 . 1.0)
			'(51 . 0.0)
			'(7 . "Style-Arial")
			'(71 . 0)
			'(72 . 1)
			(cons 11 (cdr (assoc 10 (entget b))))
			'(100 . "AcDbText")
			'(73 . 0)
		  )
	 )
       (entdel b)
     )
     )
   )
 )
 (princ)
)

 

 

 

Hi Ronjonp,

excellent work, it made our work so simple, thank you so much for your help:) i am fully satisfied with your lisp work :thumbsup:

Link to comment
Share on other sites

Hi Ronjonp,

excellent work, it made our work so simple, thank you so much for your help:) i am fully satisfied with your lisp work :thumbsup:

 

Glad to help :)

Link to comment
Share on other sites

Hi Ronjonb,

one more help on that same lisp, i tried changing the font style to "Arial Black" instead of "Arial", but its not working, could you please check & help me on that ?

 

Thanks,

Amb

Link to comment
Share on other sites

Maybe this?

(defun c:foo (/ a p s)
 (entmakex '((0 . "STYLE")
      (100 . "AcDbSymbolTableRecord")
      (100 . "AcDbTextStyleTableRecord")
      (2 . "ArialBlack")
      (70 . 0)
      (40 . 0.0)
      (41 . 1.0)
      (50 . 0.0)
      (71 . 0)
      (42 . 0.125)
      (3 . "ariblk.ttf")
      (4 . "")
     )
 )
 (if (setq s (ssget '((0 . "insert") (2 . "SITE_ANNO") (66 . 1))))
   (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
     (and (setq p (cdr (assoc 10 (entget b))))
   (setq a (vl-some '(lambda (x)
		       (if (= "ADRESSE" (vla-get-tagstring x))
			 (vla-get-textstring x)
		       )
		     )
		    (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
	   )
   )
   (entmake (list '(0 . "TEXT")
		  '(100 . "AcDbEntity")
		  '(67 . 0)
		  '(8 . "SITE_ANNO")
		  '(62 . 1)
		  '(6 . "ByBlock")
		  '(100 . "AcDbText")
		  (cons 10 p)
		  '(40 . 2.0)
		  (cons 1 a)
		  '(50 . 0.0)
		  '(41 . 1.0)
		  '(51 . 0.0)
		  '(7 . "ArialBlack")
		  '(71 . 0)
		  '(72 . 1)
		  (cons 11 p)
		  '(100 . "AcDbText")
		  '(73 . 0)
	    )
   )
   (entdel b)
     )
   )
 )
 (princ)
)

Edited by ronjonp
Link to comment
Share on other sites

Maybe this?

(defun c:foo (/ a p s)
 (entmakex '((0 . "STYLE")
      (100 . "AcDbSymbolTableRecord")
      (100 . "AcDbTextStyleTableRecord")
      (2 . "ArialBlack")
      (70 . 0)
      (40 . 0.0)
      (41 . 1.0)
      (50 . 0.0)
      (71 . 0)
      (42 . 0.125)
      (3 . "ariblk.ttf")
      (4 . "")
     )
 )
 (if (setq s (ssget '((0 . "insert") (2 . "SITE_ANNO") (66 . 1))))
   (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
     (and (setq p (cdr (assoc 10 (entget b))))
   (setq a (vl-some '(lambda (x)
		       (if (= "ADRESSE" (vla-get-tagstring x))
			 (vla-get-textstring x)
		       )
		     )
		    (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
	   )
   )
   (entmake (list '(0 . "TEXT")
		  '(100 . "AcDbEntity")
		  '(67 . 0)
		  '(8 . "SITE_ANNO")
		  '(62 . 1)
		  '(6 . "ByBlock")
		  '(100 . "AcDbText")
		  (cons 10 p)
		  '(40 . 2.0)
		  (cons 1 a)
		  '(50 . 0.0)
		  '(41 . 1.0)
		  '(51 . 0.0)
		  '(7 . "ArialBlack")
		  '(71 . 0)
		  '(72 . 1)
		  (cons 11 (cdr (assoc 10 (entget b))))
		  '(100 . "AcDbText")
		  '(73 . 0)
	    )
   )
   (entdel b)
     )
   )
 )
 (princ)
)

 

 

 

Hi Ronjonp,

this is exactly which i want, you work is perfect.

Thank you so much for your help!!!

 

Regards,

Amb

Link to comment
Share on other sites

Glad to help :)

 

 

Hi Ronjonp,

similar kind of another block i tried with modifying your given lisp, but its not happening,can i post it as a new post?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...