TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: sln8458 on November 17, 2020, 07:40:35 AM

Title: Change text in DCL dialogue from lisp file
Post by: sln8458 on November 17, 2020, 07:40:35 AM
Like the proverbial 'bad penny' I'm back :-)

Following on from here-> https://www.theswamp.org/index.php?topic=56178.msg601393#msg601393 (https://www.theswamp.org/index.php?topic=56178.msg601393#msg601393) <-

Up until now I have concentrated on the 'flanges' part of my dialogue, and have completed all of the 3D blocks.
Here is a reminder of the dialogue:-
(https://serving.photos.photobox.com/464189153776982f9455f085bdb52557ffb93a410d7e67c7a87a2801842e6ab7b3e90cdd.jpg)

Today I started on the fitting, specifically the 90deg long radius elbows. I created the 'dim' text files and made my first trial run.
All worked fine except, due to my poor planning (I put my hand up to this now) I realise that the text in the 'Dimensions' box is no longer relevant to the 'fittings'

Question: Is there a way I can change the text (label) in the Dimensions box via the lisp file to reflect the new selection?
Steve
Title: Re: Change text in DCL dialogue from lisp file
Post by: kozmos on November 17, 2020, 08:46:27 AM
In DCL file, change tile type from text into text_part and give each one a key. then u can set_tile that key with new content
Title: Re: Change text in DCL dialogue from lisp file
Post by: roy_043 on November 17, 2020, 09:22:15 AM
In DCL file, change tile type from text into text_part and give each one a key. then u can set_tile that key with new content
That is not necessary. You can also change text tiles from Lisp. It is labels that you cannot change at runtime.
Title: Re: Change text in DCL dialogue from lisp file
Post by: sln8458 on November 17, 2020, 09:34:23 AM
Thanks guys,

it IS the label I wanted to change

Code: [Select]
:text { label = "Flange O/D     O:";alignment=left;}
Steve
Title: Re: Change text in DCL dialogue from lisp file
Post by: roy_043 on November 17, 2020, 09:59:45 AM
In a DCL file you can use the value attribute or the label attribute to set the content of a text tile. AFAIK using the label attribute will add a big margin (+30%) to the right of the text. In the cases where I wanted to change a text tile at runtime I have not specified either the value or the label for the text, but only the key. You will have to try for yourself if specifying the label or the value in the DCL has an impact.

To change a text at runtime use the set_tile function:
Code: [Select]
(set_tile "tileKey" "new text")
Title: Re: Change text in DCL dialogue from lisp file
Post by: sln8458 on November 17, 2020, 12:52:00 PM
Thanks Roy,

Just back from my daily walk, Dr orders!!
While out I got to thinking along those lines, ie remove the label & add a 'key'

I'll have a play tomorrow, see how it goes and post back.

S.
Title: Re: Change text in DCL dialogue from lisp file
Post by: sln8458 on November 18, 2020, 04:53:44 AM
A quick update:

I have got Roy_043 suggestion working :)

For anyone else reading here is a snippet of my changes:

Original DCL
Code: [Select]

            :row {
:text { label = "Flange O/D     O:";alignment=left;}
:text { key = "n1";alignment=right;}
}

Revised DCL
Code: [Select]

          :row {
:text { key = "labeln1";alignment=left;}
:text { key = "n1";alignment=right;}
}

Original LSP
Code: [Select]
(defun RB11_FLAG ()
(setq flg "wn_") ;store flange type
);end rb11_flag


Revised LSP
Code: [Select]
(defun RB11_FLAG ()
(setq flg "wn_") ;store flange type
(set_tile "labeln1" "Flange O/D O:")
);end rb11_flag

S.