Begin your Archicad journey with our free learning path - perfect for newcomers and experienced users looking to strenghten their skills.

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

How to extract tree textures or tree type from placed GSM objects

vesalaasanen
Contributor

I'm developing an add-on that needs to extract textures of trees placed in a scene. I've made progress but I'm still missing a crucial piece of the puzzle.

What I've accomplished so far:

  • I can identify when a tree object is placed in the scene (Deciduous Trees.gsm)
  • I can extract the GSM file and analyze its structure

My challenge:

When I extract the GSM object, I only get information about the general "Deciduous Trees" object, but not which specific tree the user placed (oak, maple, etc.), nor can I find the path to its textures.

From my logs, I can see:

  • The GSM path: .../Plants and Outdoor Accessories/Plants/Deciduous Trees.gsm
  • I can access parameter definitions, but the actual values seem empty

My specific questions:

  1. How do I determine which specific tree type was placed in the scene?
  2. How do I access the instance parameters (not just the GSM object parameters)?
  3. What's the best way to get the path to the actual textures used for this specific tree?

I suspect I need to access the instance parameters rather than just examining the GSM object definition, but I'm not sure about the correct approach in the API.

1 REPLY 1
LChen
Graphisoft
Graphisoft

Hi, I'd suggest you to use ACAPI_Element_GetMemo () to get the instance parameter values, you can get actual value of tree type index from memo.params array. For actual textures, as the default Deciduous Trees.gsm is using embedded textures, so you're not able to get the file path.

HTH.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!