How can i have a user input a part number into a form and generate a edrawings model view through files only in a selected folder?
select part number from Generate table in edrawings ?
don't use API.→ need edrawing api.
Well, you can achieve that with e-drawings professional api which a premium product of SolidWorks. This is also to mention that the exact functionalities you are asking for are available in Solidworks EPDM.
Not sure if this is what you're looking for, but I've attached a VBA macro that will let you search for a part number in a folder. If found, the file is opened in SOLIDWORKS, an eDrawing file is saved and then opened. It doesn't use the eDrawings API, just SOLIDWORKS. Hope it helps!
i would like to use the edrawings application for this so i could install edrawings on other non CAD user computers
You could do that by:
'Set swApp = Application.SldWorks
Dim partNumber As String
partNumber = InputBox("Enter the part number to publish:")
Dim folderPath As String
folderPath = InputBox("Enter the folder path to search (C:\MyFiles\Parts\):")
Dim file As String
file = Dir(folderPath & partNumber & "*")
Do While Not file = ""
Dim filePath As String
filePath = folderPath & file
'Dim eDrawingPath As String
'eDrawingPath = PublishEdrawing(filePath)
file = Dir
This will just open the SOLIDWORKS files directly in eDrawings without publishing an extra copy. The user could save the file as eDrawings if needed.
Hope this is what you are looking for:
API: eDrawings x64 Control Host Example and this 2015 SOLIDWORKS API Help - Getting Started
I've tested in my system and it works. There is additional work to be done if the production machine does not have solidworks installed...
yes Amen! That's what i need. I've gotten that form all set up, but i would like to create a search box in the form that the user could enter a part number and pull the correct file from a specified folder i've created?
I've created a similar application for a customer where they can search for the SW files (part, assembly and drawings) in the specified path and then that would open in form as edrawings. That was a paid version so I can not share that for free.
Help is on the way Josh:
I've attached a WinForms project that you can get some inspiration. It let's you pick a folder and search for a particular file inside (through a drill down). But I need to tell you a few things:- The search code is synchronous. This means so that if the search folder is large and deep, it will block your application UI until its finishes the search. The solution is to use async and await keywords for asynchronous. You'd need NET 4.5 or higher.- It will find and return the first match in the case of multiple occurrences.
- You'd need to register the edrawing assembly in the host machine (the machine that doesn't have solidworks installed) using regasm.
Okay i can get NET 4.5 and yes the computers that i will be installing edrawings to will not have any solidworks applications on them besides the edrawings. Also That search box would work fine but i would like to combine the first picture you sent me with the edrawings model viewer and a search box for the user input of the part number.
Thanks a lot, Amen
Try this. You misunderstood me about the framework version. What I tried to say is the code needs to be modified in order for the UI not to freeze when search for files in large and deep directories. I'll see if I can modify this later. For now, it does the job.
yup this is just what i need. Except could you possibly include the edrawings file extension (.eprt) automatically so the user doesn't have to type that in with the part number? and for the button "browse for folder" could you create a password to enable the admin to change the file location? so that it is locked from changing the browse location folder for none admin users?
Retrieving data ...