Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Autotext in 3D text

eldhead
Newcomer
Hi!
I thought I could write <SHORTDATE> in object 3D text but it doesn´t seem to work. It had been great to show date in for example IFC-files.
Archicad 7 - 24, HP ZBook 15 Mobile Workstation, Win 10
13 REPLIES 13

Laszlo Nagy
Community Admin
Community Admin
There is a GDL command you can use to get the Date and Time:

n = REQUEST ("DateTime", format_string, datetimestring)

Returns the current date and time as a formatted string in datetimestring. Uses the DateTime Add-On, opening and closing the required channel.
format_string: Format string, described at paramString parameter of the section called “Opening Channel” .
datetimestring: the formatted string is returned in this variable
The requests cause warning if used in parameter script.
....................................................................................................
Get Archicad Tips at https://twitter.com/laszlonagy
AMD Ryzen 1700X CPU, 48 GB RAM, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), WIN10 PRO ENG, AC20-AC25
Loving Archicad since 1995

eldhead
Newcomer
Hi, sorry
I don't know GDL.
Archicad 7 - 24, HP ZBook 15 Mobile Workstation, Win 10

Lingwisyer
Rockstar
You cannot use autotext with that object as the internal code formatting required is different between displaying a parameter, the text you enter into the object settings, and displaying a static or autotext.

This thread is regarding the AC object and not about actual scripting, though the actual modification required is pretty simple if that is all you are needing.

Open the object
3D Script
Replace the following
TEXT B, 0, f

with

TEXT B, 0, "<SHORTDATE>"
Save as new short date object.



Ling.
AC22-23 AUS 7000
Self-taught, bend it till it breaks.

Win10 | E5620 x 2 | 24GB | K2200 RIP PSU
Win10 | R5 2600 | 16GB | GTX1660

Laszlo Nagy
Community Admin
Community Admin
Lingwisyer wrote:
This thread is regarding the AC object and not about actual scripting

It needs scripting to solve the issue, as you just showed.
....................................................................................................
Get Archicad Tips at https://twitter.com/laszlonagy
AMD Ryzen 1700X CPU, 48 GB RAM, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), WIN10 PRO ENG, AC20-AC25
Loving Archicad since 1995

Lingwisyer
Rockstar
Actually, just tested it, and Autotext does NOT work with the Text command...

Use the Date Time AO. Just place the following in the master or 3d script.
f = ""
ch = OPEN ("DateTime", "", "%d/%m/%y")
n = INPUT (ch, "", "", f)
CLOSE (ch)



Ling.
AC22-23 AUS 7000
Self-taught, bend it till it breaks.

Win10 | E5620 x 2 | 24GB | K2200 RIP PSU
Win10 | R5 2600 | 16GB | GTX1660

Laszlo Nagy
Community Admin
Community Admin
Ling,

I think using the REQUEST command would be simpler as you then do not have to deal with opening and closing files, and the GDL Reference Guide says that this REQUEST command is actually using the DateTime I/O Extension.
....................................................................................................
Get Archicad Tips at https://twitter.com/laszlonagy
AMD Ryzen 1700X CPU, 48 GB RAM, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), WIN10 PRO ENG, AC20-AC25
Loving Archicad since 1995

eldhead
Newcomer
This was harder than I thought, nothing works.
Archicad 7 - 24, HP ZBook 15 Mobile Workstation, Win 10

The Date and Time Add-On demonstrated by Lingwisyer definitely works and allows you to manipulate the format. I use it in most of my GDL objects and just tested applying it to a 3D script and it works perfectly.

After putting Lingwisyer's code into the Master Script then just put the text command in the 3D script. You will also want to consider defining the style and size of the text using a "Define Style" & "Set Style" function before the "text" command.

All these GDL functions are explained in the GDL reference guide accessed via your help menu.


!define style "name" "font", size, anchor, face code
define style "text 01" "Arial Narrow", 2.5, 5, 0

set style "text 01"

text 0, 0, f  ("f" is from Lingwisyer's script)

Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Lingwisyer
Rockstar
Also remember to replace your object with the one you modified as you cannot modify GS library parts as they do not have an open CC licence. I think you will also need to use the Save As function as Save will do nothing, rather than defaulting Save As...



Ling.
AC22-23 AUS 7000
Self-taught, bend it till it breaks.

Win10 | E5620 x 2 | 24GB | K2200 RIP PSU
Win10 | R5 2600 | 16GB | GTX1660

Mats_Knutsson
Advisor
Sometimes I just love you guys! Kristan & Lingwisyer this time


I attach a small video on an origo object I just did and also a question related to the UI. I have a yes/no parameter and would like to grey out the "next" parameter if I choose no in the former.... the video explains it.
I suppose I need to start building the UI with buttons and forms and stuff...haven't dared to go into that route yet since my time to do GDL is like nothing...this was on my spare time...I was a fun little practice and I couldn't stop until I was done. Two hours including a rewrite...(I admit I'm that slow at GDL)


Mats
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.

Looks good Mats!
It so much fun getting intelligent responses out of your own GDL objects.
There are two things you can do to the manual data parameter based on the on/off parameter; you can "Lock" it and you can "Hide" it. As you don't have a graphical UI I think it is best to just "Hide" it, then you don't have to lock it. But if you are going to create a UI then hiding doesn't work through the function shown below.

The code would be as follows;
assuming the on/of parameter is called: bManualDate
assuming the manual date parameter is: stManualDate

if bManualDate = 0 then
        lock "stManualDate"
        hideparameter "stManualDate"
endif
For on/off (boolean) parameters "0" is off and "1" is on. I personally don't like using the "0,1" values when writing my script because the idea of writing "=" for a boolean parameter bothers me, seeing as though it is only necessary for the off value; for example, if the value is on we simple write:
if bManualDate then
because bManualDate returns the positive value of 1
so for the negative we write:
if not(bManualDate) then
because when it is turned off it equals "0", the negative response, so to run the "if" command we need a positive response so we turn it into a positive with the "not()" function as "not(0)" = "1". make sense?
so I would write your code like this:

if not(bManualDate) then 
        lock "stManualDate"
        hideparameter "stManualDate"
endif
Writing it like this makes it easy to read what it is doing.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Lingwisyer
Rockstar
Kristian wrote:
if bManualDate then
/
if not(bManualDate) then

I never thought to write it like that. Makes it sooooo much easier to track what is going on. Thanks for the tip.



Ling.
AC22-23 AUS 7000
Self-taught, bend it till it breaks.

Win10 | E5620 x 2 | 24GB | K2200 RIP PSU
Win10 | R5 2600 | 16GB | GTX1660

your welcome Ling.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!