Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Editing objects

2raarchitecture
Booster

Thank you for your time and attention. I am working on electrical layouts and the roofs for this residence are steep. I would like to have a better way to see it so I may edit. Please, I want to edit the electrical symbols, which are library objects, to do two things: 

 

1. Include a 3D morph that I can see in the 3D window

2. Show the object's ID. I am going around it by adding a label later, yet it's another element to edit. 

 

Again your time is very valuable and I appreciate your feedback. Best regards.


Screen Shot 2022-07-04 at 23.50.32.pngScreen Shot 2022-07-04 at 23.51.19.png
2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

2raarchitecture:

 

A simple line of code to display the element's ID via the 2D Script is:

Text2 0, 0, GLOB_ID

 

You should add a Signature to your Profile (click the Profile button near the top of this page) with your Archicad version and operating system (see mine for an example) for more accurate help in this forum.

 

David

David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14

View solution in original post

12 REPLIES 12
2raarchitecture
Booster

I am starting with a 2D rather than a 3D object. I have changed the 2D Symbol for a 3D library part before, and this is new. This other object does have script for text, and I wonder if it could match the object's element ID instead. Would you know the script for this, please?


Screen Shot 2022-07-05 at 00.10.27.pngScreen Shot 2022-07-05 at 00.10.33.png
2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full
Solution

2raarchitecture:

 

A simple line of code to display the element's ID via the 2D Script is:

Text2 0, 0, GLOB_ID

 

You should add a Signature to your Profile (click the Profile button near the top of this page) with your Archicad version and operating system (see mine for an example) for more accurate help in this forum.

 

David

David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14

David, 

Thank you! I am attempting this line of code next. Will you please let me know about more codes I can give a try?

2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full

David, 

 

Thank you for your line of code. 

 

Please, allow me to ask for further help. I am trying to write the code to change the text size and location. Code below

 

!
! Name : RECESSED Exterior Downlight.gsm
! Date : Tuesday, October 16, 2018
! Version : 22.00
! Written by Archicad
!

mul2 A/0.289280, B/0.289160
add2 65'-11.0782", -51'-5.5596"
set line_type lineTypeAttribute_1
pen penAttribute_1
fill fillAttribute_1
poly2_b{5} 5, 3, 0, 3, penAttribute_2, penAttribute_3,
0'-0.0000", 0'-0.0000", 3'-3.3701", 0'-0.0000", 0'-0.0000", 3'-3.3701", 0'-0.0000",
-65'-11.0782", 52'-4.9439", 1,
-65'-11.0782", 51'-5.5596", 1,
-64'-11.6892", 51'-5.5596", 1,
-64'-11.6892", 52'-4.9439", 1,
-65'-11.0782", 52'-4.9439", 1
pen penAttribute_2
line_property 0
Text2 0, 0, GLOB_ID
circle2 -65'-5.3713", 51'-11.2486", 0'-4.5973"
2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full

I figured out how to change the text location, but I am also trying to figure out how to change its size

2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full

2raarchitecture:

 

To control the text's font, size, etc. you ned to do two things, in this order.

1. Define the text style:

DEFINE STYLE name font_family, size, anchor, face_code

See the GDL Reference Guide for an explanation of this command. These parameters could be hard coded or parametric.

2. Then set the text style:

[SET] STYLE name_string

This sets the style of the subsequent text, an object can use multiple text styles if they have been defined in the code.

 

Thanks for adding your signature.

 

David

 

David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Lingwisyer
Guru

If you are not wanting the text to scale to your view, divide ac_textsize_1, or what every parameter you are using for text size by GLOB_SCALE.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
2raarchitecture
Booster

Thank you kindly for your feedback. I did look at both comments. It works now! Thank you!

2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full
2raarchitecture
Booster

Please, if you may kindly share more resources regrading GDL scripting, I would be very thankful for it. 

2RA Building Workshop
www.2rabldgworkshop.com

11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz. 16.0 GB. NVIDIA GeForce RTX 3060 Laptop GPU.
ArchiCAD 25. 5002 USA Full