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

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-AC26
Loving Archicad since 1995

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

Lingwisyer
Legend
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 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
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-AC26
Loving Archicad since 1995

Lingwisyer
Legend
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 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
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-AC26
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
Legend
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 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!