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.
getting featurescript via api

is there any way i can get the same featurescript in the viewer from the api
for example this simple revolve feature has featurescript code from viewer:
features.FAyVI6vEZcpidzb_0 = function(id)
{
annotation { 'unused' : true }
var features = features;
if (true)
{
{
}
var KFXjFVcPbihHCj_query;
KFXjFVcPbihHCj_query=qCompressed(1.0,"&29f$eJydkl1PwjAUhv9MvZSsg27jcl9AZR/Q1pB5Q7a1SsV90G3q/PUOMESjiQk3TXve933OOUlvHATWnVB9iCjUAZdNWmTyqUtbWZVe2qY2DPXfCutrQS3A4lUcxPNkuIqyla0UjW3YuqsNtAxwoeSr4DNVFadKejb1x7CTAv/yoBPge3N/iOxk01aq/8K7xLcZjqNBqGqhTp0xd3SAuQ0phCMDzKgRPOpldb8IsmSjttqbVCKu6RQcjludQBzQpc/cxdaPGGYJFaDZizbfnQfAnOZAIPWw7g6dc2gigohBTGKRqZsPbW75yASyqJUsW5JTE+BwRXDEPHhelExO5yVEMpITTsRAzV5KxlpYJx+1/GaA+uCAYwLRvwREVqiwtF6LhXEdgW3w+12l268onF9HKAW0nwWmFl6r6wjBZN+P1TLvXcv7k0CQaw6fYGa7/k/tE+1dzlc=",id);
var SeVnJdEVUepVNu_query;
SeVnJdEVUepVNu_query=qCompressed(1.0,"%B5$QueryM5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6$FS6Lf2noUHLbYWr_0wireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdSc$Xd7RoGhLWkwk",id);
annotation { "Feature Name" : "Revolve 1" }
revolve(context, id + "FAyVI6vEZcpidzb_0", { "bodyType" : ExtendedToolBodyType.SOLID, "operationType" : NewBodyOperationType.NEW, "surfaceOperationType" : NewSurfaceOperationType.NEW, "entities" : qUnion([KFXjFVcPbihHCj_query]), "surfaceEntities" : qUnion([]), "wallShape" : qUnion([]), "midplane" : false, "thickness1" : { 'value' : try(0.25 * inch), 'expression' : "0.25 in" }.value, "flipWall" : false, "thickness2" : { 'value' : try(0 * inch), 'expression' : "0 in" }.value, "thickness" : { 'value' : try(0.25 * inch), 'expression' : "0.25 in" }.value, "axis" : qUnion([SeVnJdEVUepVNu_query]), "revolveType" : RevolveType.FULL, "oppositeDirection" : false, "angle" : { 'value' : try(30 * degree), 'expression' : "30 deg" }.value, "angleBack" : { 'value' : try(330 * degree), 'expression' : "330 deg" }.value, "defaultScope" : false, "booleanScope" : qUnion([]), "defaultSurfaceScope" : true, "booleanSurfaceScope" : qUnion([]), "asVersion" : FeatureScriptVersionNumber.V2260_AUTO_POPULATE_OWNER_ENTITY_MATE_CONNECTOR_FIX });
i have the feature_id , wid, eid and did
can i get this same featurescript or more specifically this part:
var SeVnJdEVUepVNu_query;SeVnJdEVUepVNu_query=qCompressed(1.0,"%B5$QueryM5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6$FS6Lf2noUHLbYWr_0wireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdSc$Xd7RoGhLWkwk",id);
via the api?
Comments
https://cad.onshape.com/glassworks/explorer/#/PartStudio/getFeatureScriptRepresentation
what are you trying to do? I'm gonna guess whatever it is that there is a better way.
Custom FeatureScript and Onshape Integrated Applications