Author Topic: highlight certain word/s  (Read 1033 times)

0 Members and 1 Guest are viewing this topic.

vincent.r

  • Newt
  • Posts: 101
highlight certain word/s
« on: February 28, 2023, 01:16:56 AM »
I want to highlight (with rectangle, circle or any other cad object. just like shown in attached sample drawing) word/s within single line text, Mtext, Attribute, fields & blocks.
How to get it done? Anybody have any clue?

Sample drawing attached.
« Last Edit: February 28, 2023, 03:33:23 AM by vincent.r »

dexus

  • Bull Frog
  • Posts: 207
Re: highlight certain word/s
« Reply #1 on: February 28, 2023, 03:01:53 AM »
How about something like this?
Code - Auto/Visual Lisp: [Select]
  1. (setq a (car (entsel))) ; Select object
  2. (redraw a 3) ; Highlight object
  3. (getstring "\nPress enter to continue: ")
  4. (redraw a 4) ; Unhighlight object

vincent.r

  • Newt
  • Posts: 101
Re: highlight certain word/s
« Reply #2 on: February 28, 2023, 03:32:16 AM »
How about something like this?
Code - Auto/Visual Lisp: [Select]
  1. (setq a (car (entsel))) ; Select object
  2. (redraw a 3) ; Highlight object
  3. (getstring "\nPress enter to continue: ")
  4. (redraw a 4) ; Unhighlight object

Thanks dexus for your time. I should have explain it before.

highlight with rectangle, circle or any other cad entity. Just like shown in attached sample drawing.

dexus

  • Bull Frog
  • Posts: 207
Re: highlight certain word/s
« Reply #3 on: February 28, 2023, 03:58:24 AM »
Oh, I see.
I didn't open the drawing because it was a more recent version of Autocad.

I guess if you use a monospace font you could calculate the position of the text.

vincent.r

  • Newt
  • Posts: 101
Re: highlight certain word/s
« Reply #4 on: February 28, 2023, 04:24:29 AM »
Oh, I see.
I didn't open the drawing because it was a more recent version of Autocad.

I guess if you use a monospace font you could calculate the position of the text.

Thanks for the suggestion, but it's not useful to me. I have to work on customers drawings.

dexus

  • Bull Frog
  • Posts: 207
Re: highlight certain word/s
« Reply #5 on: February 28, 2023, 08:15:36 AM »
How about adding: {\\L\\O and } around the text so it renders a line above and below it?
Not a full square, but might be a simple way of accentuating text.

hmspe

  • Bull Frog
  • Posts: 362
Re: highlight certain word/s
« Reply #6 on: February 28, 2023, 10:02:35 AM »
I have attached a function I use in a TEXT editor I wrote that draws a rectangle around a portion of a text entity.  In my function the text string is the variable gv-text_string and the ename for the text string is in the variable gv-text_ename, both of which are defined in the parent function.  The two arguments for draw cursor are the left and right character positions for the portion of the string you want to highlight, zero based.

Maybe this can give you a start.  You would probably want to change the code so the text string ename is passed to the draw_cursor function as an argument rather than being non-localized and so that the string value is obtained by (vle-entget 1 gv-text_ename).

Edit:  The attached code uses Bricscad VLE- functions.  Bricscad has a support file named vle-extension.lsp in the Bricscad Lisp Developer Support Package (https://boa.bricsys.com/applications/a/?lisp-developer-support-package-(ldsp)-a720-al1176)  that can be apploaded to provide VLE functions in non-Bricscad CAD systems, or used as a guide to modify the code I posted.   

« Last Edit: February 28, 2023, 11:43:01 AM by hmspe »
"Science is the belief in the ignorance of experts." - Richard Feynman

vincent.r

  • Newt
  • Posts: 101
Re: highlight certain word/s
« Reply #7 on: March 01, 2023, 12:34:09 AM »
How about adding: {\\L\\O and } around the text so it renders a line above and below it?
Not a full square, but might be a simple way of accentuating text.

Its not useful to me. We cant control thickness, color and layer of render lines.

vincent.r

  • Newt
  • Posts: 101
Re: highlight certain word/s
« Reply #8 on: March 01, 2023, 12:35:26 AM »
I have attached a function I use in a TEXT editor I wrote that draws a rectangle around a portion of a text entity.  In my function the text string is the variable gv-text_string and the ename for the text string is in the variable gv-text_ename, both of which are defined in the parent function.  The two arguments for draw cursor are the left and right character positions for the portion of the string you want to highlight, zero based.

Maybe this can give you a start.  You would probably want to change the code so the text string ename is passed to the draw_cursor function as an argument rather than being non-localized and so that the string value is obtained by (vle-entget 1 gv-text_ename).

Edit:  The attached code uses Bricscad VLE- functions.  Bricscad has a support file named vle-extension.lsp in the Bricscad Lisp Developer Support Package (https://boa.bricsys.com/applications/a/?lisp-developer-support-package-(ldsp)-a720-al1176)  that can be apploaded to provide VLE functions in non-Bricscad CAD systems, or used as a guide to modify the code I posted.   

Thanks hmspe for your time. Working on it. will get back you soon.