How to generalize output three files .dxf

Hi everyone,

Can anyone help me, how to generalize output three files .dxf from api model parameters

image

As you can see below, we general model by parameters

And now we want to export 3 dxf files with the same parameters as above.

Best,

The function to trigger exports is called api.exports.requestAsync() in viewer 2. I also suggest you migrate your code to viewer 3 as you develop your application, since support for viewer 2 will end next year. You can check this migration guide which both explains how to trigger exports in viewer 2 and how to switch from the viewer 2 code to viewer 3.

1 Like

Thanks,

now default they will output file format 3dm, how can i export with .dxf format.

allowed objects

Best.

You or the Grasshopper designer who created the file need to use the “Drawing Export Options” component along with the “Download Export” component to control which file format is used for exporting.

1 Like

I have a little problem, when i send a request with name “coin-9”
image

name coin

message
image

Can you or someone help me.

Best.

Each export asset has its own name, which is not the name of the model. In the deprecated viewer version 2 that you are using, you can list all export assets and their name by calling api.exports.get(). Then you can use the names listed there to trigger each export asset individually.

1 Like

another problem, when i change other parameter value it doesn’t work properly.

I tried it with name, id, array, object but it’s not correct.

after i use dxf demo download file the value is not changed.

Best.

Can you please share the lines of code you are using to update parameters and then trigger the exports?

yes, that here.

This is the code you use for exporting, but my suspicion is that you do not wait for the parameter update promise to return before you trigger the export, therefore I would need to see the part where you update a parameter and then try to trigger the export.

Sorry, I just noticed the issue: you cannot pass parameters as arguments when you request an export. You need to update the parameters and then trigger the export.

thanks you, I tried and it works.

with this link, how do i get tmp file to upload

Please explain what the issue is, I have not understood it. This link is the url to download the exported file. The link is valid for the length of the viewer session.

I want to download the file from that link, then upload that file to our server.

The process of handling the download/upload of a file from a url depends on the setup of your application and javascript/node.js methods which are completely independent of ShapeDiver and its API. If you describe your setup in more details, our team might be able to give you some pointers, but keep in mind that this is beyond the scope of the ShapeDiver product.

I read that file and wrote it using file_put_contents.

Thanks you.

I’m working on production, and it has this message. Can you explain the reason for this message.

image

For some parameter values, the data sent to the export component in Grasshopper might be empty, which is when you see this message. Please contact the person who created the Grasshopper definition and make sure that for the parameter values you are using, there is indeed data sent to the export component. It might be that you need to switch a boolean to true to enable the export.

1 Like