Results 1 to 6 of 6
Thread: Ruby Global Attribute ?
-
09-06-2013, 05:20 AM #1
Ruby Global Attribute ?
I want to add one or more Global Attributes to a Layout Box and assign values to them so that I can access those values from other referenced macros.
How do I do that?
Maybe Gerry can answer this - I'm stumped.
If it can be done I think I could create a Sheet Index on the fly.Joseph P. Carrick, Architect - AIA
ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
Windows 8.1
Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium
-
09-06-2013, 08:33 AM #2
Joe:
I'm not exactly sure what you want to do?
BUT, But you can add any global variable to ruby by just adding a $ sign in front of your variable. as in $myglobal = "sometext" You can then address from another macro just by using something = $myglobal.
put that into a ruby macro and add into to the layout box label. it does not have to return anything and you probably don't want it to. Just put a nil in the last line to stop any output-- the Global will still be set.
If you need more details or can be more specific let me know and I'll make a video if necessary. Did that give you want you need?Gerry
NewCraft Home Services
Design/ Compliance Review
PE, X6 , Sketchup 8, TurboCad Pro 20
-----------------------------------
ASUS P9X79D, i7-3820, GTX680 w/4gb
-----------------------------
If the Government would just cut down more d*** trees, I'd have a much better view of the forest.
-
09-06-2013, 09:01 AM #3
Thanks Gerry,
I'm actually approaching the problem a little differently. Essentially what I'm trying to do is generate a Sheet Index, Sheet Numbering & Sheet Naming - basically in an automated fashion.
I've found a way to retrieve a text string that will automatically fill in a sheet index. The text is retrieved from a file and looks like this:
$Sheet_Index =
G-1 COVER SHEET
G-2 GENERAL NOTES
G-3 SCHEDULES
A-1 SITE PLAN
A-2 1ST FLOOR PLAN
.......
I need to parse this text into 2 arrays which would be Global.
$aSheets[1] = "G-1", .... etc.
$aSheet_Names[1] = "COVER SHEET", .... etc.
So now, the question is how to parse the data. Do you have a nice algorithm to do that?
I can easily populate the Sheet Index with just the full $Sheet_Index
I want to use the arrays to display the Sheet Numbers and Sheet Names in other locations based on the value of %page%Joseph P. Carrick, Architect - AIA
ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
Windows 8.1
Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium
-
09-06-2013, 10:49 AM #4
Joe:
we might have to talk about this one because there are many, many ways to store the data depending on what you want to do? I'm assuming you want a hash with the drawing name as key and title as value? Or do you want to store arrays within a hash with dwg and tile in a array or want separate arrays? note that once data is in global memory, it stays there and can cause conflicts if new data is introduced or deleted. This has to be managed -- so I clear the hash on every update and rebuild. Chief needs to fix this?????????
I attached a macro to parse your text file. I placed in c:\as\ --- change to your dir & file name. Your using a separate file for each dwg. You could put all the indexes in the same file and parse for a plan name to start? Also you're starting on line 3 -- not sure you need to do this.
Also remember, that %page% is a name/value pair and not available to ruby.Gerry
NewCraft Home Services
Design/ Compliance Review
PE, X6 , Sketchup 8, TurboCad Pro 20
-----------------------------------
ASUS P9X79D, i7-3820, GTX680 w/4gb
-----------------------------
If the Government would just cut down more d*** trees, I'd have a much better view of the forest.
-
09-06-2013, 12:15 PM #5
Hi Gerry,
I have everything working except for the %page% problem.
I used .dump and .split() to separate the strings into 2 arrays (Sheet_Numbers & Sheet_Names).
I found that the Layout Box has an attribute "referenced_full_filename" that provides access to a file that I store with the same name as the plan but as .txt. This allows me to edit the text file and automatically fill in my Sheet Index. The real problem is that because %page% is not available to Ruby I can't match up the arrays to the actual page.
There has to be a way to get the Layout Page as a Ruby attribute
CA - Please open up this data - maybe just add an attribute page_num to the Layout BoxJoseph P. Carrick, Architect - AIA
ASUS M51AC Desktop, core i7-4770 CPU @3.4 GHZ, 16 GB Ram, NVidea GT640 with60M with 3GB GM, 30" HiRes (2560/1600) Monitor , (2) 24" ASUS Monitors
Windows 8.1
Chief Architect 9, 10, X1, X3, X4 Premium, X5 Premium, X6 Premium
-
09-06-2013, 12:56 PM #6Gerry
NewCraft Home Services
Design/ Compliance Review
PE, X6 , Sketchup 8, TurboCad Pro 20
-----------------------------------
ASUS P9X79D, i7-3820, GTX680 w/4gb
-----------------------------
If the Government would just cut down more d*** trees, I'd have a much better view of the forest.