Search the Knowledge Base Report a bug
Post new topic   Reply to topic   printer-friendly view   .    ArchiCAD-Talk Forum Index >>> Libraries / Library Parts / GDL >>> Accessing Project Info Values Goto page Previous  1, 2, 3
View previous topic :: View next topic
Author Message
Juha Vesen
Active member
Active member

Joined: 18 Nov 2004
Posts: 358
Location: Helsinki, Finland

PostPosted: Sun Dec 20, 2009 11:03 pm    Post subject: Re: Accessing Project Info Values Reply with quote

Hello vistasp,

I think it cannot be done. The autotext is kind of a version of this card game. The content can be shown but is not known Shocked

Code:

Blind man's bluff (also called Indian poker, or squaw poker or indian head) is a version of poker that is unconventional in that each person sees the cards of all players except his own.
The standard version is simply high card wins. Each player is dealt one card that he displays to all other players (traditionally stuck to the forehead facing outwards- supposedly like an Indian feather).

_________________
--
Juha Vesen
ArchiCAD 4.1 --- 20
Mac Intel 2.5 GHz Intel Core i7 16Gb | OSX 10.10
Back to top
View user's profile Send private message AIM Address    
Samppa Hannikainen
New member
New member

Joined: 18 Apr 2008
Posts: 45
Location: Finland

PostPosted: Wed Jan 27, 2010 11:26 pm    Post subject: Re: Accessing Project Info Values Reply with quote

Hello,

I did some experimenting on this subject, and managed to write a script for reading manually exported projectinfo xml values into a string array. It gave me a chance to familiarize myself with the xml i/o addon. I think this is something like what Karl Ottenstein and Erwin Edel mentioned in this thread.

Anyway, I thought I could share this and maybe save somebody the trouble of doing it from scratch. The script below should be placed in the object's master script.

I've tested this on AC11 only, but I think it should work on later versions too. One thing that's still bugging me is updating the object's array when the xml-file is updated. It only seems to update on a full library update. Maybe someone could give some help on that?


Code:

!Project info XML Script
!-----------------------
!Usage:
!
!Project info needs to be exported manually every time something is updated.
!
!This script will query the exported file and return a string array projectInfo[n][2]
!(in which 'n' is the total number of project info entries)
!
!If you prefer to have the xml-file to loaded in libraries, set XmlInLibs=1
!If you prefer to select the file through dialog from another location, set XmlInLibs=0
!
!The returned array is organized as follows:
!projectInfo[1][1]=UIKey 1 [projectinfo entry title]
!projectInfo[1][2]=value 1 [projectinfo entry value]
!projectInfo[2][1]=UIKey 1
!projectInfo[2][2]=value 2
!
!..etc..
!
!------------------------


!-----------------------Initialize variables
XmlFilename=""      !Put your xml filename here, or set as parameter
XmlInLibs=1      !See description above

!The array
DIM projectInfo[][2]

!Xml handling
read = 0
nds = 0
openmode = ""
name = ""
val = ""
keyw = ""
cursor = ""
fixKeyEntries = 0
customKeyEntries = 0


!-----------------------Test XML filename
IF XmlFilename="" THEN GOTO 1


!-----------------------Initialize XML file for reading
IF XmlInLibs = 1 THEN                                    !either
   openmode = "rl"                                       !you have loaded the XML-file in your project libraries
ELSE                                                !or
   openmode = "rd"                                       !You want to point file location manually
ENDIF
channel = OPEN ("XML", XmlFilename, openmode)


!-----------------------Test XML file
read = INPUT (channel, "NewPositionDesc", "", cursor)            !Init cursor at root location
read = INPUT (channel, "GetNodeData", cursor, name, val, keyw)      !Get root node data
IF name # "ProjectInfo" THEN GOTO 1                           !Just a quick check


!-----------------------Feed 14 fixed entries to array
read = INPUT (channel, "MoveToNode FromFirstChild FixKeys", cursor, name, val, keyw)      !Move to FixKeys root
read = INPUT (channel, "NumberofChildNodes * Fix*", cursor, nds)                      !Count Fixed Key entries
fixKeyEntries = nds

read = INPUT (channel, "MoveToNode FromFirstChild Fix*", cursor, name, val, keyw)         !Move to first FixKey-entry

FOR i = 1 to nds
   read = INPUT (channel, "MoveToNode FromLastChild value", cursor, name, val, keyw)      !Move to value-entry
   read = INPUT (channel, "MoveToNode FromFirstChild * CDATA", cursor, name, val, keyw)   !Move to actual data

   projectInfo[i][2] = val                                                   !Store Data
   
   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to value-entry
   read = INPUT (channel, "MoveToNode FromPrevSibling UI*", cursor, name, val, keyw)      !Move to UIKey-entry
   read = INPUT (channel, "MoveToNode FromFirstChild * CDATA", cursor, name, val, keyw)   !Move to actual data

   projectInfo[i][1] = val                                                   !Store Data
                        
   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to value-entry
   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to FixKey-entry
   read = INPUT (channel, "MoveToNode FromNextSibling Fix*", cursor, name, val, keyw)      !Move to next FixKey-entry
NEXT i      

read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)                  !Move Back to FixKeys root
read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)                  !Move Back to ProjectInfo root


!-----------------------Test custom entries
read = INPUT (channel, "NumberofChildNodes * Custom*", cursor, nds)             !Search for CustomKeys root entry
IF nds = 0 THEN GOTO 1                                                !If none, quit


!-----------------------Feed custom entries to array
read = INPUT (channel, "MoveToNode FromFirstChild Custom*", cursor, name, val, keyw)      !Move to CustomKeys root
read = INPUT (channel, "NumberofChildNodes * Custom*", cursor, nds)                   !Count Custom Key entries
customKeyEntries = nds

read = INPUT (channel, "MoveToNode FromFirstChild Custom*", cursor, name, val, keyw)      !Move to First CustomKey entry root

FOR i = fixKeyEntries+1 to fixKeyEntries+customKeyEntries
   read = INPUT (channel, "MoveToNode FromLastChild val*", cursor, name, val, keyw)      !Move to value-entry
   read = INPUT (channel, "MoveToNode FromFirstChild * CDATA", cursor, name, val, keyw)   !Move to actual data

   projectInfo[i][2]=val                                                   !Store Data

   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to value-entry
   read = INPUT (channel, "MoveToNode FromPrevSibling UI*", cursor, name, val, keyw)      !Move to UIKey-entry
   read = INPUT (channel, "MoveToNode FromFirstChild * CDATA", cursor, name, val, keyw)   !Move to actual data

   projectInfo[i][1] = val                                                   !Store Data

   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to UIKey-entry
   read = INPUT (channel, "MoveToNode ToParent", cursor, name, val, keyw)               !Back up to CustomKey-entry
   read = INPUT (channel, "MoveToNode FromNextSibling Custom*", cursor, name, val, keyw)   !Move to next CustomKey-entry
NEXT i


!-----------------------Close XML file
read = INPUT (channel, "ReturnPositionDesc", cursor, name, val, keyw)
CLOSE channel



1:   !Project info XML Script over

_________________
---
Samppa

AC20 (FIN) / Windows 10 Pro
Back to top
View user's profile Send private message    
Braza
Veteran member
Veteran member

Joined: 08 Jun 2006
Posts: 585
Location: Portugal

PostPosted: Thu Jan 28, 2010 11:48 am    Post subject: Re: Accessing Project Info Values Reply with quote

Hi Samppa,

Now THIS is a workaround! Surprised

Thanks for sharing. Smile

Regarding the updating: It seems that the xml i/o addon needs some upgrade.

_________________
Paulo Henrique Santos, Arch.
I7/6Gb R/512Mb V-Vista64-AC12#2675
ArchiCAD Warehouse
ArchiTruques
Back to top
View user's profile Send private message    
F. Beister
Veteran member
Veteran member

Joined: 29 Oct 2003
Posts: 676
Location: Hamburg, Germany

PostPosted: Fri Nov 02, 2012 2:05 pm    Post subject: Re: Accessing Project Info Values Reply with quote

I have integrated this XML export - import workaround into OpenLibraryGlobals. Works for fixed autotext only. Custom autotext values can not be transfered, because arrays are not readable from MVO.
Back to top
View user's profile Send private message Visit poster's website    
Display posts from previous:   
View previous topic :: View next topic
Post new topic   Reply to topic   printer-friendly view       ArchiCAD-Talk Forum Index >>> Libraries / Library Parts / GDL >>> Accessing Project Info Values All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2001, 2005 phpBB Group
Copyright 2012 - Graphisoft SE. All rights reserved worldwide. Terms of Use | Privacy Policy