Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
importing a FS into a document
billy2
Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
So I'm using the same featurescript code over and over in different documents by copying the source code between documents. If I make any changes to the featurescript, I have to remember which document has the latest featurescript code to copy from.
My thought was to create a document called "featurescripts" and then import featurescript code from this versioned document. You know, take advantage of versioning.
I have 2 documents:
-featurescripts
-FS print
Here's "FS print" working and the featurescript code:
Here's "FS print" working and the part studio:
"FS print" is working, so let's break it and send the working part of the code to "featurescript".
Take the working code out of document "FS print":
paste into document "featurescripts" and then create a version of the document:
go back to document "FS print" and import featurescript:
it doesn't work
I've tried moving the data back to document "FS print" without success:
I'm interested in importing my featurescript and taking advantage of version control. Can't seem to get things to wire up properly. Is this possible?
When importing, how do I access a previous version of a document "featurescript"?
If I ever get this to work and create a new version of the document "featurescript", will everything blow apart?
Since only documents can be versioned, is it wise to have a document for each featurescript and not gang all featurescripts together into one document?
My thought was to create a document called "featurescripts" and then import featurescript code from this versioned document. You know, take advantage of versioning.
I have 2 documents:
-featurescripts
-FS print
Here's "FS print" working and the featurescript code:
Here's "FS print" working and the part studio:
"FS print" is working, so let's break it and send the working part of the code to "featurescript".
Take the working code out of document "FS print":
paste into document "featurescripts" and then create a version of the document:
go back to document "FS print" and import featurescript:
it doesn't work
I've tried moving the data back to document "FS print" without success:
I'm interested in importing my featurescript and taking advantage of version control. Can't seem to get things to wire up properly. Is this possible?
When importing, how do I access a previous version of a document "featurescript"?
If I ever get this to work and create a new version of the document "featurescript", will everything blow apart?
Since only documents can be versioned, is it wise to have a document for each featurescript and not gang all featurescripts together into one document?
0
Comments
If you move the line "const data = BLOB_DATA.csvData" below the import, that error should go away.
To simplify things, I'm adding both listing again.
This comes out of my "featurescripts" document and includes the code I want to import:
This is the working document "FS Print" and I want to include code from the document "featurescripts" which is at version v5.
Any other ideas?
This seems like it would be a very common pattern that many will want to use. What am I doing wrong?
Once again this is what I want:
I want to re-use the same feature script in multiple documents. If you do this, the document "featurescript" must be versioned.
It's important to note that I'm using different imported data for each document ("FS print", "billy's print" and "ugly print"). This means that I have split the feature script into 2 location and pass the data from one document to another using setVariable.
So here's the feature script code I want to share, document name is "featurescripts":
Notes:
- shared feature script "featurescript" must be in a versioned document
- my any document "FS print" has data it's sending to shared script
- I had to process data in each any document then send it shared script
- one shared featurescript under version control, fantastic
If anyone has a cleaner pattern, please post,