mhupp Posted October 4, 2022 Posted October 4, 2022 I guess you could link the text to the line with a hyperlink or select nearest. but its not saving any clicks so why not just select the line? Quote
TemporaryCAD Posted October 4, 2022 Posted October 4, 2022 I'm not sure what you're trying to do, but if you want click and drag to edit capability use dynamicblocks. Quote
Steven P Posted October 4, 2022 Posted October 4, 2022 Reading your question as you write it, yes you can. If I read it correctly, you want to select a text, then an object and offset or move that object by the value of the text? How is your LISP programming? You can use something like (setq MyText (entget(car (entsel "Select Text")))) or (setq MyText (entget (ssname (ssget "_+.:E:S" '((0 . "TEXT"))) 0))) to get the text definition, and then use (setq MyTextVal (assoc 1 MyText)) To extract the value of the text The text value should be returned as a string, not a number. You can change a string to a number using atoi and after that apply that to the object you want to move, copy or offset. You might want to do a check that the text is a number before you do atoi else it will be an error Is that enough to give you a clue and help you work out what to do? 1 Quote
faizur Posted October 4, 2022 Author Posted October 4, 2022 1 minute ago, Steven P said: If I read it correctly, you want to select a text, then an object and offset or move that object by the value of the text? How is your LISP programming? Yes, that's I want to do. I'm noob in this field, trying to learn something by seeing others code Quote
Steven P Posted October 4, 2022 Posted October 4, 2022 1 hour ago, faizur said: I'm noob in this field, trying to learn something by seeing others code Best way to learn is by having a go.... Taking it step by step then, start by making a LISP file - you should be able to do that and copy this into it which will allow you t select text and get the value, then can take the next step and you'll learn as you go along: (defUn c:test ( / Mytext MyTextVal ) ;;define the LISP routine. After the / are local variables used only in this LISP (princ "Select Text") ;; princ - puts a message in the command line (setq MyText (entget (ssname (ssget "_+.:E:S" '((0 . "TEXT"))) 0))) ;; Select a selection, the other parts linit this here to 1 tect object (setq MyTextVal (cdr (assoc 1 MyText))) ;; get the text from the selected text above MyTextVal ;;returns the text value from this LISP ) ;; end the routine See if this works for you then can do the next step 2 Quote
BIGAL Posted October 4, 2022 Posted October 4, 2022 If you made it a leader then you could do with 1 pick so long as end of arrow is on line. You can get the pt and the text from the properties of a leader Quote
faizur Posted October 5, 2022 Author Posted October 5, 2022 11 hours ago, Steven P said: Best way to learn is by having a go.... Taking it step by step then, start by making a LISP file - you should be able to do that and copy this into it which will allow you t select text and get the value, then can take the next step and you'll learn as you go along: (defUn c:test ( / Mytext MyTextVal ) ;;define the LISP routine. After the / are local variables used only in this LISP (princ "Select Text") ;; princ - puts a message in the command line (setq MyText (entget (ssname (ssget "_+.:E:S" '((0 . "TEXT"))) 0))) ;; Select a selection, the other parts linit this here to 1 tect object (setq MyTextVal (cdr (assoc 1 MyText))) ;; get the text from the selected text above MyTextVal ;;returns the text value from this LISP ) ;; end the routine See if this works for you then can do the next step It's working and geting the text value Quote
BIGAL Posted October 5, 2022 Posted October 5, 2022 Select text, select line, ok now the buggy part does offset go left or right ? If its always away from text then easy. (defun c:wow ( / ent off pt ent2 pt2) (setq ent (entget (car (entsel "\nPick text ")))) (setq off (atof (cdr (assoc 1 ent)))) (setq pt (cdr (assoc 10 ent))) (setq ent2 (entsel "\nPick line ")) (setq pt2 (cadr ent2)) (command "offset" off ent2 (polar pt2 (angle pt pt2) 10.0) "") ; increase 10 if problems dummy point ) (c:wow) 1 Quote
faizur Posted October 5, 2022 Author Posted October 5, 2022 3 hours ago, BIGAL said: Select text, select line, ok now the buggy part does offset go left or right ? If its always away from text then easy. (defun c:wow ( / ent off pt ent2 pt2) (setq ent (entget (car (entsel "\nPick text ")))) (setq off (atof (cdr (assoc 1 ent)))) (setq pt (cdr (assoc 10 ent))) (setq ent2 (entsel "\nPick line ")) (setq pt2 (cadr ent2)) (command "offset" off ent2 (polar pt2 (angle pt pt2) 10.0) "") ; increase 10 if problems dummy point ) (c:wow) Thanks man, it works Quote
faizur Posted October 5, 2022 Author Posted October 5, 2022 13 minutes ago, faizur said: the buggy part does offset go left or right Yes. But the code offset works only below the text Quote
BIGAL Posted October 6, 2022 Posted October 6, 2022 Not sure your question, maybe look at comment about changing value 10 in code. Quote
faizur Posted October 7, 2022 Author Posted October 7, 2022 On 10/6/2022 at 6:57 AM, BIGAL said: changing value 10 in code 10 to what? for left/right offset Quote
BIGAL Posted October 8, 2022 Posted October 8, 2022 (edited) Post more detail what your asking for, my crystal ball is out being polished. Edited October 8, 2022 by BIGAL 1 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.