cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Documentation
About Archicad's documenting tools, views, model filtering, layouts, publishing, etc.
SOLVED!

Replace Name Layout With Drawing Name in

cagarruta
Booster

Hi to all!

I have a lot of layouts with PDF inserted.

Is there any way to replace the name of the layout with the hosted single name drawing (PDF) in?

Attached image to explain it

 

get drawing name and paste to layout name.png

 

Thanks in advanced.

JCG

 

Operating system used: Windows 24H2

Archicad 25 SPA v6000

i9 14900K/32 Gb DDR4/1TB SSD/10GBPS Lan/Windows 11 PRO
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Hero

@cagarruta  schrieb:

I have a lot of layouts with PDF inserted.

Is there any way to replace the name of the layout with the hosted single name drawing (PDF) in?


That's possible with Python.

The following script will rename all Layouts in a given folder (change it before running obviously) to their first placed drawing.
Caveat: It is currently impossible to tell what kind of drawing is placed on a layout! So this will cover internal drawings just as well as external PDFs.

That's why it's needed to restrict this to a given folder. It's also undoable. So please beware.

 

import archicad

try:
	conn = archicad.ACConnection.connect()
	assert conn

	acc = conn.commands
	act = conn.types
	acu = conn.utilities

except AssertionError:
	raise RuntimeError("No Archicad instance running!")


subset_name = "MY FOLDERNAME"
# rename :	  ^^^^^^^^^^^^
# *****************************#

layoutBookTree = acc.GetNavigatorItemTree(act.NavigatorTreeId("LayoutBook"))

# get the approppiate Folder:
subset_itemList = acu.FindInNavigatorItemTree(
	layoutBookTree.rootItem, lambda node: node.name == subset_name
)

# The following gives not the subset as-is, but instead a list of
# discrete 'NavigatorItemArrayItem's (sic)...
for item in subset_itemList[0].children:
	# is a Drawing placed?
	if item.navigatorItem.children is not None:
		acc.RenameNavigatorItem(
			item.navigatorItem.navigatorItemId,
			item.navigatorItem.children[0].navigatorItem.name,
		)

 

 

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

3 REPLIES 3
Solution
runxel
Hero

@cagarruta  schrieb:

I have a lot of layouts with PDF inserted.

Is there any way to replace the name of the layout with the hosted single name drawing (PDF) in?


That's possible with Python.

The following script will rename all Layouts in a given folder (change it before running obviously) to their first placed drawing.
Caveat: It is currently impossible to tell what kind of drawing is placed on a layout! So this will cover internal drawings just as well as external PDFs.

That's why it's needed to restrict this to a given folder. It's also undoable. So please beware.

 

import archicad

try:
	conn = archicad.ACConnection.connect()
	assert conn

	acc = conn.commands
	act = conn.types
	acu = conn.utilities

except AssertionError:
	raise RuntimeError("No Archicad instance running!")


subset_name = "MY FOLDERNAME"
# rename :	  ^^^^^^^^^^^^
# *****************************#

layoutBookTree = acc.GetNavigatorItemTree(act.NavigatorTreeId("LayoutBook"))

# get the approppiate Folder:
subset_itemList = acu.FindInNavigatorItemTree(
	layoutBookTree.rootItem, lambda node: node.name == subset_name
)

# The following gives not the subset as-is, but instead a list of
# discrete 'NavigatorItemArrayItem's (sic)...
for item in subset_itemList[0].children:
	# is a Drawing placed?
	if item.navigatorItem.children is not None:
		acc.RenameNavigatorItem(
			item.navigatorItem.navigatorItemId,
			item.navigatorItem.children[0].navigatorItem.name,
		)

 

 

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

Thanks so much, Runxel.
I've been meaning to learn Python to use with Archicad, and I think the time has come.

Archicad 25 SPA v6000

i9 14900K/32 Gb DDR4/1TB SSD/10GBPS Lan/Windows 11 PRO
cagarruta
Booster

Awesome Runxel!!

 

it works at first time!

 

thanks a lot!

 

cagarruta_0-1743360215002.png

 

Archicad 25 SPA v6000

i9 14900K/32 Gb DDR4/1TB SSD/10GBPS Lan/Windows 11 PRO

Setup info provided by author