Jump to content

Select specific blocks inside polyline and update the selected Mtext/Text information


rk25134

Recommended Posts

Select the specific blocks inside polyline/polygon and update the selected Mtext/Text information into below mentioned tag values of the blocks

 

tag names: ST_NAME

HSE_NO

 

It should ask the Block name.

tst.JPG

Link to comment
Share on other sites

Are you talking about Attributed Block ?

What is the new text string that you want to replace the current one with ?

 

Sample drawing mostly describes the goal much more better than words ;)

Link to comment
Share on other sites

I am trying to remember the post but I did a lisp for selecting text within a polyline it should be simple to modify to find a block and update the attribs is part2.

 

here is a start needs modifying to look for Insert, the dwg posted has no info about what is to be replaced need more detail.

 

; this is not finished code
(vl-load-com)
(defun getcoords (ent)
 (vlax-safearray->list
   (vlax-variant-value
     (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
     )
   )
 )
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) ))
(setq coordsxy (cons xy coordsxy))
(setq I (+ I 2))
) ; end repeat
) ; end defun

; program starts here
; choose output file change acdatemp to what you want

(setq plobjs (ssget (list (cons 0 "lwpolyline"))))
(setq numb1 (sslength plobjs))
(setq x numb1)
(repeat numb1
(setq obj (ssname plobjs (setq x (- x 1))))
(setq co-ords (getcoords obj))
(co-ords2xy)
; write pline co-ords here
(setq numb3 (length co-ords))
(setq z numb3)
(setq ansco-ords "")
(repeat numb3 
(setq ansco-ords (strcat ansco-ords (rtos (nth (setq z (- z 1)) co-ords) 2 3 ) " " ))
)
(setq ans (strcat "Pline " ansco-ords))
(write-line ans fout)
(setq ansco-ords "")
(setq ss (ssget "WP" coordsxy (list (cons 0 "Insert")))) ; selection set of Blocks within polygon
(if (= ss nil) 
(princ "\nnothing inside")
(progn 
(setq coordsxy nil) ; reset for next time
(setq numb2 (sslength ss))
(setq y numb2)
(repeat numb2
; this where you would do attrib bit

(princ "\n")
) ; end repeat2
(setq ss nil) ; reset for next poly
)
)
) ; end repeat1
(close fout)
(princ)

Link to comment
Share on other sites

Just use a lisp, ssget with a filter for the block UTUID and update, just pick street name 1st then select relevant blocks say by a polygon window. Plenty of examples around. I would do multiple at a time rather than 1 lot at a time.

Link to comment
Share on other sites

Use fields value rk25134. you only have to do it once. Whatever is the value on the the TAGS ST_NAME and HSE_NO the TEXT string value will follow or is it the other way around? But still, FIELDS is the way to go.

Link to comment
Share on other sites

Pbe nice idea just pick text as a field if you rename blocks update.

 

I guess we will never know if its enough to solve the OP's problem, perhaps the OP has all but given up on this thread. :)

Link to comment
Share on other sites

Need a lisp for below requirement

 

I need to update automatically the block attribute of tag value (HSE_NO) from the text/mtext located in the same closed polygon.

 

Ex.

1. In a closed polygon/polyline there will be a text or mtext having some values that need to entered into the blocks which are locating in the same closed polygon/polyline

2. text/mtext is in layer HSENO and the block attribute is HSE_NO

3. I tool will find more than one text/mtext that need to entered into another block which is located in the same block.

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...