I'm building an app that deals with engineering projects. Part of the app requires uploaded CAD files (.dwg) to be assigned to equipment.
What I would like to do is edit the meta data of each file to contain a reference to the part it has been assigned to.
So if a file was linked to part X1234567 I'd like to add this 'tag' to the meta data of the CAD file.
I have been working with the Forge API and see there is an endpoint for extracting meta data documented here but I see no way to put edited data back in to the file.
Is there any way to use the Forge API, PHP, Java or JS to write a method to extract metadata, edit it then save it back to the file?
I'm open to any suggestions to how I can do this.
Thanks
I should also note Java is my last choice, sorry Java guys, I'd really like to keep this in PHP or JS, but can dust off my Java skills if that's the only way.
I read your question as you want to edit metadata within a DWG (not the data that is attached to the DWG file in A360). Presumably you want to edit Xdata or Xrecords. To do this, you should use the Design Automation API (not the Model Derivative API).
The Design Automation API is essentially a headless version of AutoCAD running on an Autodesk server (the API used to be called AutoCAD I/O). You can use this API to run any script against any DWG as long as you don't require user interaction. You can also run custom actions (commands) that you have defined using the AutoCAD LISP, .NET or ObjectARX APIs (i.e. you can upload your own script or add-in to the service and run it against your DWG.
Documentation for Design Automation API is here - https://developer.autodesk.com/en/docs/design-automation/v2/overview/.
There are some samples on GitHub here - https://github.com/Developer-Autodesk/AutoCAD.io.
Related
I would like to write a js for an offline website (located on a local Windows server or any other server). It's supposed to look for files like PDFs in several directories and display them as search result on the "website", which isn't a real website, since it's on a local server and not in the web. The PDF is supposed to open in the browser after clicking it. I already have this kind of search engine as a php file, which I wrote with some help from friends. I also want to share this site with other friends. Basically I'll send them the whole folder with the html - document (or the .php site), so they can use it to search for certain pdfs in the folder. Its like a offline wiki for medical research documents. But I don't want them to always install php on their local servers, so they can run my php-searchmachine, thus I need to write it new as a javascript. By google and stack overflow I came across this solution https://www.codegrepper.com/code-examples/javascript/find+file+in+directory+javascript but it seems like that this needs node.js, so all have to install node.js, which is similar to installing php, I guess (im not familiar with node.js). Also I'm not sure if node.js is running on a normal client or server, which is not a webserver.
How can I start with such a project? Is javascript the correct attempt to solve this?
Windows Search has the ability to search PDF contents when boosted by a PDF (index) iFilter, this means the user can search and find instantly a new search word or a saved search it took only a second to hand enter this search (actually took longer to save for double click next time) just for illustration I chose a word I knew was in one file and actually found it is also in two other PDFs.
The problem for your JS coding is how to use JavaScript to interface with Windows Search since using explorer I could not run that search on a remote server shared library drive (I could see their contents as per second screen but for search, had to pull a local library copy down to my documents) and that is where your JS skills come into play. Personally I would avoid JS and use a VLC method to share view via a remote Lan server or simpler invoke a plain text indexed local copy of remote files for download as and when required.
The question is brief because I don't exactly know how to start approaching the problem to understand it.
I have identified the .aspx file (in my C# web app project) where an export picture is located, when pressing on it an .xlsx can be downloaded (with content taken from the database), where do you suggest to start the investigation to understand just HOW this file is generated? - I'm interested in the SQL query that is executed to populate the excel.
You may think of it in another way, if this was given you as a task, how would you sketch a plan to generate an excel from a C# web app project based on an SQL query that populates Sheet1?
PS it's not a macro file. Thank you for any pointers.
Just don't use the excel COM for a webapp. Instead check out Epplus or maybe the Apache POI project has something that works with .NET for generating excel files.
Basically you'll just run your database query, put the data in the worksheet w/ your formatting etc, then send it off to the client. You could stream it out or post it somewhere for download later.
You have lots of options just need to break this down into parts.
To answer the initial question "where do you suggest to start the investigation to understand just HOW this file is generated?":
Investigate the export picture with your browser tooling, for instance in Chrome you can do a inspect element from the context menu when you right click on the image. Some possibilities:
A form is submitted ASP.Net style, find the function it is calling on the target ASPX/ASHX page. Set a breakpoint in that function, hit it, follow the code.
Javascript code is run, probably doing a JSON call to a service MVC/WebAPI function. Set a breakpoint in that function, hit it, follow the code.
Still can't find it, search for the word ContentDisposition in the code, this is needed 99% of the times to send files to the client browser as an attachment.
I need to create a Windows 7 Gadget (or Widget) as a mini project. I know how to create a basic HelloWorld gadget (including the xml manifest and the html page), but I do not know how to make a complex one.
My company uses a bug tracking software (say, XYZ). My widget needs to be able to access and display data from XYZ regarding bugs, given a bug ID, or other search criteria.
I currently have the APPGUID and server name for XYZ.
Please help. I do not know where to start.
If your bug tracking software (XYZ) is a web application then you need to use its web service or you need to scrape the site to access the data regarding the bugs. You can simply scrape the site using the Simple HTML DOM.
Example can be seen in PHP Simple HTML DOM Scrape External URL
To download the library the link is http://sourceforge.net/projects/simplehtmldom/files/
Then you can scrape and display the data as the normal HTML code.
OR you have to use the web service provided by the XYZ application.
I need a code for how to browse for folder (not file) using JSP and Javascript.
I looked for the JAVA code for browse for folder using JFileChooser library but I want the default window to be opened (which opens in browse for file).
I'm developing a webapp which will scan the folder based on the path and will generate the output.
Thanks in advance.
1.I need a code for how to browse for folder (not file) using JSP and Javascript.
Javascript does not have access to the file-system due to security reasons, as this answer says and also this answer.
So you would have to use flash or java applet as suggested in this answer or else you would have to wait till the time HTML5 File API matures :-)
But, if your requirement is that your a User (may be with administrator rights in the application) logins to the web-application through a web-browser and wants to scan (view the contents of) the particular folder on the server side (where the web-app is deployed and not the file system on his own machine) then you can use the suggestion given in this answer, just to elaborate on this:
Have a <form> which will have a text-box (to take the folder name or full-path) in the JSP, on submit of this form a request will be sent to the server.
The response would be list of files (List<String>) in that particular folder passed through the request.
you can also submit the request through ajax in which case you would return a JSONArray as suggested.
Now on the Server it would be normal Java File API stuff to fetch all the files in the folder you get from the request.
Sorry to say this but I don't think you would get a ready-made code to do what you want and that is not how things work on SO.
2.I looked for the JAVA code for browse for folder using JFileChooser library
You said you are building a web-app right? JFileChooser is a Swing component and as far as I know cannot be used in JSP to achieve what you desire.
3.I'm developing a webapp which will scan the folder based on the path and will generate the output.
The steps are explained in point (1).
Hope this helps and gives relevant hint and direction to go forward.
I am writing a very simple Elearning application for my virtual class. I wander if there may be a way using Javascript that works on the background to read the content of a file located on the user's computer and send its content to my server. Any one knows an open source code of Javascript doing this ?
I think that this can be done using XMLHttpRequest, i.e. AJAX, but I could not graps my way through. Any help
You can't gain access to a local file in browser because you are in sandbox, but there are some File API for Html 5 that you can programmatically select them and access their data just have a look at the following link
File API
Web applications should have the ability to manipulate as wide as possible a range of user input, including files that a user may wish to upload to a remote server or manipulate inside a rich web application. This specification defines the basic representations for files, lists of files, errors raised by access to files, and programmatic ways to read files. Additionally, this specification also defines an interface that represents "raw data" which can be asynchronously processed on the main thread of conforming user agents. The interfaces and API defined in this specification can be used with other interfaces and APIs exposed to the web platform.
Unfortunately there is no way to give JavaScript any access to the user's local files.
There is a very serious security issue with that.
There is however API for that on IE browsers (Which give nice big warning when you attempt to access the files)
I recommend to ask from the user to upload his own file (using <input type="file" />) and upload it to the server.
HTML5 specifications specify an API to access the local filesystem. It is supported in the latest versions of Chrome. See here for details http://net.tutsplus.com/tutorials/html-css-techniques/toying-with-the-html5-filesystem-api/.
If the environment is controlled (i.e in a classroom or intranet) you can build your application using this API.