cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Mapkey export to stl

Re: Mapkey export to stl

YES! - CREOSON can easily perform the process you outlined.

 

The basics of this would be the following in "pusdo code":  (assuming active model is the generic you want to process) 

 

// get the list of instance names from the active model

genericModel = file : get_active

instNames = file : list_instances

 

// export images - not a "render" - but a "render" could done via mapkey most likely for the actual "render" function

foreach instName in instNames

     file : open - file = instName, generic =  genericModel(rootname)

     // optionally set the orientation

     view : activate <viewName>

     interface : export_image - type - JPEG

 

// drawings to pdfs (assumes drawing name is same as instance name)

foreach instName in instNames

     file : open - instName(rootname)+".drw"

     interface : export_pdf

 

The above workflow would be simple to implement in JavaScript or Python via CREOPYSON.

 

Hope that is clear enough.

 

Dave

Re: Mapkey export to stl

Thanks a lot for your reply.

 

In your youtube-videos you seem to use Node.js to run the Javascript-code ? Now I wonder how to set up this environment to use it for creoson on windows 10.

I've downloaded Node.js and hit the install-button. Before the installation it asks me if I want to install some C++-compiler-stuff that is required for some modules.

 

NodeJS1.JPGNodeJS2.JPG

 

Do I need this to run Creoson ? I don't want to install something I won't need...

And where can I find the creoson-module that are required for Node.js ?

Are there some more basic examples on how to use creoson with Node.js?

 

A lot of basic questions... 😃

 

Thanks,

Maik

Re: Mapkey export to stl

Cool - thanks for taking interest in CREOSON!

 

CREOSON can be simply configured and up and running by running the CreosonSetup.exe.  This starts the CREOSON service that will connect to Creo and listen for HTTP requests that can come in from any language using JSON transactions for command/response structures.  It is independent of any language/environment you want to use to write your automations with.

 

Node.js is just one (1) option for working with the CREOSON service. (Node.js is specific to JavaScript).  Node.js, VB, Python, etc. are all options for working with CREOSON because CREOSON is just a http interface that passes JSON transactions back and forth to perform operations in Creo.  CREOPYSON as an option if you prefer Python - and has a pre-build set of interfaces similar to what you are looking for and has been very well received due to its simplicity.

 

We have not (yet) put together a formal Node.js library - but you could copy the code that is in our playground.html and run it from Node.js pretty easily.   And we have a few other ideas on how to make CREOSON even more approachable for quick things (more on that in a couple of months most likely).

 

A quick way to play around and do your own thing would be to just copy/paste the playground.html in the CREOSON/web directory and use that code as a reference to build other functions and workflows.  If you keep your new file in your CREOSON/web folder you can simply load it in your web browser and make calls to CREOSON from that.  I recommend a good HTML editor for this (Sublime is a good choice - and it is also FREE).

 

Note: CREOSON has a built in HTTP server - so you would be accessing your copied page from http://localhost:9056/<yourNewFile>.html after CREOSON is up and running.

 

The Playground has a few examples in code that you can see by just simply "Viewing Source" for the HTML document and scrolling down to where the code is (e.g. "<!--CREOSON DEMO CODE-->" script block).  It should be pretty obvious - but does require some external libraries to make it work for HTML interfaces (see the script references at the top of the HTML source) since it is a web page.  Much of that code updates the HTML interface to inform the user of changes and status... so the actual code would be less than in that playground.html file.  It should be failure obvious on how it works... each function is basically a structure that is commonly used ... then you just sequence them together (in our example) for the workflow you want.

 

You should be able to copy/paste some of the functions in that page to make new ones pretty quickly - e.g. creoOpenModel could be copied to a new function for exporting DXFs, or running a mapkey to export a STL, and then you just have to fill in the proper request object properties.

 

Note: mapkeys are a bit special... you have to put a delay after you run them to ensure they can complete before your next steps in your code. (e.g. setTimeout... - in javascript)  this allows the mapkey to complete before running the next step in your code.

 

We may develop a special library for Node.js like CREOPYSON did for Python. (that was a great idea by the guy that built that).

 

After you get things working in HTML (again just playing around and testing) - moving the code to Node.js is pretty easy...  but the intent there would be to setup a more production process for doing things (e.g. scheduled task or a service interface that could be tied into other business systems, or a stand alone application that could be distributed and shared - all things which go beyond this response).

 

Let me know if any of this did not make sense.  And thanks for your interest in CREOSON!

 

Dave

 

 

 

 

 

Announcements