erikpar Posted June 3, 2009 Posted June 3, 2009 Hello I´m working in a project with a lot of doors and windows (d/w). Each d/w have some kind off alarm. Take a look att parment.com map PDF file 1.pdf (I´m not aloud to have a link in my messages). I have insert a block outside the building and a line from the block to the d/w. There ar two different blocks one for new d/w and one for existing d/w. My problem is that I want to put the coordinates of the d/w into the block. My idea is like this: "Pick endpoint of line" to get the coordinates. "Pick the block" for updating attribute "YKOORDINAT" and "XKOORDINAT". I have spent a lot of time on Internet trying to find out how to do so please help me. /Erik Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Is it the insertion point of the block itself that you want as the attributes? or a different block's coordinates? Just to clarify Quote
erikpar Posted June 3, 2009 Author Posted June 3, 2009 Take a look at pdf-file. I updated it to make it easier to see what I meen. The block is the rectangel and the line is just a line to mark witch door the block belongs to. /Erik Quote
BlackAlnet Posted June 3, 2009 Posted June 3, 2009 That lisp you want is like a lisp Lee Mac write for me, maybe, i can help you. But...I can't find the pdf file. Quote
erikpar Posted June 3, 2009 Author Posted June 3, 2009 Hello! I´m not aloud to use links in my messages yet. Take a look at parment.com/PDF/1.pdf I´ll try to attatch an image. /Erik Quote
BlackAlnet Posted June 3, 2009 Posted June 3, 2009 You want the coordinates beside the block, as a "MTEXT" or "TEXT"? Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Hello! I´m not aloud to use links in my messages yet. Take a look at parment.com/PDF/1.pdf I´ll try to attatch an image. /Erik OK Eric, I understand now - I shall see what I can do for you Quote
BlackAlnet Posted June 3, 2009 Posted June 3, 2009 Try this one (not tested, but i think it works...) (defun c:texb () (setq ed (getpoint "\nPick end point of line: ")) (while (/= ed nil) (setq x (car ed)) (setq y (cadr ed)) (setq bp (getpoint "Base point of coordenates : ")) (command "text" "j" "tl" (list bp) "" "" (strcat "X=" (rtos x 2 3))) (command "text" "j" "bl" (list bp) "" "" (strcat "Y=" (rtos y 2 3))) (setq ed (getpoint "\nPick end point of line: ")) ) (princ) ) Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Try this: {untested} (defun c:Co2Blk (/ pt bEnt bObj) (vl-load-com) (if (and (setq pt (getpoint "\nSelect Coordinate: ")) (setq bEnt (car (entsel "\nSelect Block to Update: "))) (eq "AcDbBlockReference" (vla-get-ObjectName (setq bObj (vlax-ename->vla-object bEnt)))) (eq :vlax-true (vla-get-HasAttributes bObj))) (foreach att (vlax-safearray->list (vlax-variant-value (vla-getAttributes bObj))) (cond ((eq "XKOORDINAT" (vla-get-TagString att)) (vla-put-TextString att (rtos (car pt)))) ((eq "YKOORDINAT" (vla-get-TagString att)) (vla-put-TextString att (rtos (cadr pt)))))) (princ "\n<!> Incorrect Selection <!>")) (princ)) Quote
BlackAlnet Posted June 3, 2009 Posted June 3, 2009 "Pick the block" for updating attribute "YKOORDINAT" and "XKOORDINAT"./Erik Haha, forget my lisp,I do not read that part right Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 Haha, forget my lisp,I do not read that part right Its still great that you took at stab at writing one though Quote
Lee Mac Posted June 3, 2009 Posted June 3, 2009 But, just as a tip if you don't mind me saying so, When automating text insertion (or Attribute creation), it is much better to use either a method using entmake or a vl method - as the prompts for the text and attribute creation can change from version to version and machine to machine. Quote
BlackAlnet Posted June 4, 2009 Posted June 4, 2009 Its still great that you took at stab at writing one though Yes, in my job, i create some lisps, do draw and extract some things. Because of this i've become promoted.(i'm that job 2 months only). So, if i only read about lisp, and not "took at stab at writing one though", i never really will now about lisps. All tips is welcome, thanks for help me!! Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 Yes, in my job, i create some lisps, do draw and extract some things. Because of this i've become promoted.(i'm that job 2 months only). So, if i only read about lisp, and not "took at stab at writing one though", i never really will now about lisps. All tips is welcome, thanks for help me!! Promoted through LISP eh...? I wonder how many people have been promoted for using a LISP I wrote for them... Quote
erikpar Posted June 4, 2009 Author Posted June 4, 2009 LeeMac, your program works perfectly. BlackAlnet, I tried to explain as best I could. Now I find someone who can do the job. There are about 2,000 blocks to be updated. /Erik Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 LeeMac, your program works perfectly. BlackAlnet, I tried to explain as best I could. Now I find someone who can do the job. There are about 2,000 blocks to be updated. /Erik Thanks Erik, I feel sorry for the poor guy who will have to go through all 2000 blocks with this... Quote
BlackAlnet Posted June 4, 2009 Posted June 4, 2009 Promoted through LISP eh...? I wonder how many people have been promoted for using a LISP I wrote for them... Haha, your lisp. That lisp of extraction was too complicated, did not like being me. I never say that is my lisp. But i write simple lisps, and that was enough for promote... I aways say i'm getting help from this forum. The problem is, i think, no one here understand how to write lisps. i'm glad for your help, tips, and explain me things about lisp!! And i want write more and more lisps. Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 Haha, your lisp. That lisp of extraction was too complicated, did not like being me. I never say that is my lisp. But i write simple lisps, and that was enough for promote... I know, I was just jokin' I aways say i'm getting help from this forum. The problem is, i think, no one here understand how to write lisps. i'm glad for your help, tips, and explain me things about lisp!! And i want write more and more lisps. I'm happy to give you tips and help as much as I can Quote
BlackAlnet Posted June 4, 2009 Posted June 4, 2009 But, just as a tip if you don't mind me saying so, When automating text insertion (or Attribute creation), it is much better to use either a method using entmake or a vl method - as the prompts for the text and attribute creation can change from version to version and machine to machine. Ok, i think abou it, and i make this (defun c:yy2 () (setq ed(getpoint "\nSelect end point: "));select the point of coords (while (/= ed nil);loop (setq x (car ed));x coord (setq y (cadr ed));y coord (setq bp (getpoint "\nBase point for coord: ")) (entmake ((0 . "TEXT")(1 . (x))(72 . 2)(73 . 3)(40 . 2,5)(10 . bp))) (entmake ((0 . "TEXT")(1 . (y))(72 . 2)(73 . 1)(40 . 2,5)(10 . bp))) (setq ed(getpoint "\nSelect end point: ")) ) (princ) ) Why it doesn't work? What's wrong?? Quote
Lee Mac Posted June 4, 2009 Posted June 4, 2009 Why it doesn't work? What's wrong?? Just about everything... (defun c:yy2 (/ ed x y bp) ; Make sure you localise your variables! (while (setq ed (getpoint "\nSelect end point: ")) (setq x (car ed) y (cadr ed) bp (getpoint "\nBase point for coord: ")) (entmake (list (cons 0 "TEXT") (cons 1 (rtos x)) ; Needs a string (cons 72 2) (cons 73 3) (cons 40 2.5) ; Real numbers cannot use commas (cons 10 bp) (cons 11 bp))) ; Needs alignment Point (entmake (list (cons 0 "TEXT") (cons 1 (rtos y)) (cons 72 2) (cons 73 1) (cons 40 2.5) (cons 10 bp) (cons 11 bp)))) (princ)) Firstly, remember to localise your variables. With the entmake lists, they need to be lists so use the "list" function. Use cons to group elements into dotted pairs. real numbers need decimals, not commas the content of the text (group 1) needs to be a string They need to have an allignment point group 11 Quote
Recommended Posts
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.