Jump to content

Possibly to import/export Instrument Data


Recommended Posts

I'm trying to create an automated process that will import and export Instrument Data. I didn't know if it was possible? I have no real python experience...

 

With that being said,  I was looking at the function DoMenuTextByName() and using Export and Export Instrument Data or Import...depending on the process.   I do know it will be (2) different scripts (import/export), but looking over at the Function references, I didn't see anything for Instrument Data.  

 

I thought I would ask before I spent time going down the rabbit hole and trying to figure it out. 

 

Thanks for any help and guidance. 

Link to comment

very possible..

 

you could use pythons native "json" support to store and retrieve data through .json files. The json module in python neatly handles converting python dictionaries to json files. I use this quite a lot for storing data outside of vectorworks. That being said, I noticed you said you had no real python experience. This is obviously necessary, however python is very easy to catch on if you have some coding experience. I started scripting with vectorscript and self-learnt python in 6 months. There are obvious differences but the python language was just more logic to me.

 

Back to your question.. you said you didn't see any info for instrument data in the function reference? I have no experience in Vectorworks Spotlight module, but if the instrument data is a record attached to an object, hen all the function calls you'd be looking for would be under the records/database section in the Dev Wiki.

 

Let me know and I'll see if I can point you in the right direction with an example script..

 

 

Edited by twk
Link to comment

My coffee hasn't kicked in yet, so hopefully this makes sense.  I have no experience in Vectorscript or Python, but I thought it would be best to begin with Python.  The general consensus from reading is Python is a great language to start learning coding. 

My thoughts where to use DoMenuTextByName().  On the Wiki, it states "Calls the specified VectorWorks menu command item."  Like I previously said, I have no real programming experience, so pardon my ignorance...

I saw in the example script for DoMenuTextByName that it used "Print".  My thoughts were maybe I can plug "Export" in its place and find the index value used for "Instrument Data".  

The Wiki points me to: Menu Function Reference for the values I can use with the function. I saw a lot of ways to export, but not Instrument Data.  Perhaps I'm reading this wrong, though.

 

 

Quote

...if the instrument data is a record attached to an object, hen all the function calls you'd be looking for would be under the records/database section in the Dev Wiki.

 

 

This is good to know.  It does contain a record, but its a little confusing to me.  I will often create my own light symbols and I attach (3) records to it: Light Info Record, Light Info Record M (metric), and Parts.  The confusing part for me is, after I do this, I then select the menu command "Convert to Instrument".  

 

For instance, here is the OIP and record for a light PROIR to "Convert to Instrument"

OIP

OIP Data

 

After conversion:
OIP_After
OIP_Data_After

 

You'll notice at the bottom, the name now reads "1000.1.1.0.0" which is the UID used when I import and export the data to relink the instrument.  

Looking further into this, I found a post here that describes what is happening...
 

Quote

Instruments do not get the light info record, SYMBOLS do. The instrument merely reads that record info. The instrument is essentially a wrapper that goes around the symbol. Read Kevin Moore's post in the thread about speed and the instrument being a recipe...

 

Sorry for the long winded post, but I'm really not sure what record I would call up or if its actually called "Instrument Data" like the Export menu reads...

 

I suppose the ultimate goal for the Export script would be:
- Gather all instruments on the plot, regardless of active class/layer...
- Export the data using tab delimiter between fields and hard return between records/instruments

Then I import into Filemaker. If I do any changes in Filemaker to a record, export it...


Import into Vectorworks, linking the UID (1000.1.1.0.0) to update any records in VW.


---

Like I said, I have it working now, its just a cumbersome process with the same menu settings being ticked on or off....  

Just trying to make it fluid, if possible.

 

I'm open to the idea of using json to write the data, though.  The ability to have Layer/Class along with other information would be nice to have and from what I can tell, is not available in "Instrument Data" export.

 

Thanks again for any help, tips, yay's, nay's or examples you can provide. 

 

 

 

Edited by MeTheMachine
Link to comment

@Sam JonesDo you want to hop in here.

 

Sam Jones writes an add-on called AutoPlot Tools for Spotlight.  I believe the original version included the ability to import and export data from lights.

 

Hopefully he can help out here.

 

Based on what you are asking, I think this project is bigger than you think.  I would estimate multiple 10s of hours to script and debug if you were an experienced programmer. If you are trying to learn to program as well, I think you are probably in the multiple 100s of hours to get is right and include all of the debugging and error checking to make sure you don't overwrite objects of create duplicate objects. And that is only for the VW part. You probably have almost as much time on the Filemaker end as well.

 

If you want to proceed, we will be glad to try and help, but the learning curve will be steep.  Sorry.

 

 

Link to comment

I understand completely.   I'm experienced with Filemaker, so I'm not worried about that side of the world.  Like I said, I have everything working fine (manually exporting and importing), I was just trying to automate those steps. 

If I get the data out of Vectorworks, whether it's json or txt, I'm fine with parsing whatever information I need into Filemaker. 

 

I've always wanted to learn Python so I saw this as a good way to begin.  I'll checkout AutoPlot, too. 

 

 

 

Link to comment

OK.  In your original post, you said you wanted to export and import instrument data.  Which instrument data?  Here are some questions that need to be answered. (BTW I have written routines to do just this)

1. Are you using Spotlight?

2. If so, do you want to export information contained in the Object Info Palette (OIP) of the Lighting Devices instances you have placed?

3. If you are using Spotlight but do not want to export information from the OIP, what information do you want to export/import?

 

4. If you are not using Spotlight, what information do you want to export/import?  If you can identify the info, it can be exported/imported?

 

It would seem from your examination of the OIP that you are using Spotlight and want to deal with the OIP data of the Lighting Devices.  If this is true, forget about the data tab.  What you want is the data contained in what is called the parametric record, called "Lighting Device"

 

Penultimately, however you identify the information you want to export/import, the actual work will be done by exporting and importing text files, either tab/comma delimited files or XML files.  Forget about calls to Spotlight menu commands.  One work around, might be creating a custom report and then using the export worksheet command to create a tab delimited file.

 

Lastly, Pat is correct I have written commands that export/import Lighting Device information.  They were designed to work with Lightwright 4, before the advent of data exchange, but they just write and read text files.  If you end up looking into AutoPlot, feel free to ask me questions.

 

If you want to learn programming just for this task, you have something of a learning curve; as to whether it is steep or long or both is to be determined.  If you are new to programming, you will need to learn about "handles", "variable scope", flow of control, variable and static variable procedure parameters, and a host of other things.  As a ray of light here, I can tell you that Andy Dunning taught himself to program after teaming up with master Vectorscripter, Gerard Jonker to write video screen tool, he continued to write a bunch of cool stuff, much of which has been incorporated in VW.

 

 

Link to comment
Quote

1. Are you using Spotlight?

- Yes. 

 

Quote

2. If so, do you want to export information contained in the Object Info Palette (OIP) of the Lighting Devices instances you have placed?

- Yes.

 

Quote

3. If you are using Spotlight but do not want to export information from the OIP, what information do you want to export/import?

The information from the OIP is great.  The data generated using AutoPlot Export is more fantastic.   Eventually, I would be handy to see the design layer and class the instrument is in, however, not too important.  

 

Quote

If you end up looking into AutoPlot, feel free to ask me questions

You just earned my $35.00 dollars.

 

 

Like I said above, my goal is really just create a script that will export the instrument data, or custom report, or AutoPlot information that I can trigger with a keyboard command.  It would be nice to have my filepath and export options saved, so no dialog menus pop up.   On the flip side, the same workflow ( i know this would be a separate script) that could handle the import side and update the instruments.  

Link to comment
9 minutes ago, MeTheMachine said:

 

On the flip side, the same workflow ( i know this would be a separate script) that could handle the import side and update the instruments.  

 

The import command in AutoPlot should work, but it will require the creation of tab delimited file to read; Filemaker should be able to handle that.  The info has to be in the same order that it was exported, and the first line should contain field names which will be ignored.  I haven't used the commands in quite some time since I work with Lightweight, but I just tried a very simple test file, and it seems to work as described.

 

In terms of using keystrokes to activate commands, this can be done with any AutoPlot commands using the Workspace editor.

 

HTH.

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...