Yes.
Iterate a valid selection set, drilling down into each Object until the desired, nested attribute tag is identified, then extract said attribute's TextString Property, then move the Block Object accordingly.

Registered forum members do not see this ad.
Hey,
Is it possible to move blocks based on an attribute inside that block.
I.e. I have 600 blocks that are correct in the x axis, however i need to move each block to a y-coordinate based on the attribute inside that block.
Cheers.
Yes.
Iterate a valid selection set, drilling down into each Object until the desired, nested attribute tag is identified, then extract said attribute's TextString Property, then move the Block Object accordingly.
"Potential has a shelf life." - Margaret Atwood

ok, not sure if i explained myself enough, I would like the blocks the move automatically? Not me move one at a time.

ok, sounds complicated
Its easy really.. post a screenshot of what it lloks like now and what you want it be after
Ok i'm bored.. so here's a sample:
HTHCode:(defun c:PlaceBlockTest () (while (setq pt (getpoint "\nPick Point for test block:")) (setq xc (rtos (Car pt) 2 4) yc (rtos (cadr pt) 2 4)) (command "_insert" "coord" pt "" "" xc yc) ) ) (defun c:btcrd (/ ss i e) (if (setq ss (ssget "_X" '((2 . "coord")))) (repeat (setq i (sslength ss)) (command "_.move" (setq e (ssname ss (setq i (1- i)))) "" "_non" (trans (cdr (assoc 10 (entget e))) 0 1) "_non" (trans (car (list (mapcar '(lambda (j) (distof (vla-get-textstring j)) ) (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)))) 0 1) ) ) ) )

thanks for your time pBe.
Thats a nice lsp that i can use for the future labelling eastings and northings.
The file attached is an example of what im trying to achieve.
I have 100's of trusses all correct for there x co-ordinate however the y co-ordinate changes all the time, and i have to manually click on each truss and move it accordinaly. I would like to move the truss to the the y co-ordinate based on the attribute value, which i import from a spreadsheet ( which the boss changes all the time).
cheers, hope u are bored again![]()
Try this Dormant ,and hope it would work for you .
Code:(defun c:TesT (/ selectionset intger selectionsetname nextentity entlst p)(vl-load-com) ;;; Tharwat 26. Feb. 2012 ;;; (if (setq selectionset (ssget "_:L" '((0 . "INSERT") (66 . 1)))) (repeat (setq intger (sslength selectionset)) (setq selectionsetname (ssname selectionset (setq intger (1- intger))) ) (setq nextentity (entnext selectionsetname)) (while (not (eq (cdr (assoc 0 (setq entlst (entget nextentity)))) "SEQEND" ) ) (if (eq (cdr (assoc 2 entlst)) "RL") (vla-move (vlax-ename->vla-object selectionsetname) (vlax-3d-point (setq p (cdr (assoc 10 entlst)))) (vlax-3d-point (list (car p) (+ (cadr p) (read (cdr (assoc 1 entlst))))) ) ) ) (setq nextentity (entnext nextentity)) ) ) (princ) ) (princ) )
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

Registered forum members do not see this ad.
many thanks Tharwat, that will work great, i can take the next few days off work
thanks to pBe for his time also.
problem solved![]()
Bookmarks