Questions tagged [solidworksapi]

The SOLIDWORKS API automates and customize the SOLIDWORKS software.The API contains hundreds of functions that you can call from Visual Basic for Applications (VBA), VB.NET, Visual C#, Visual C++ 6.0 , and Visual C++/CLI. These functions provide direct access to SOLIDWORKS functionality such as creating a line, inserting an existing part into a part document, or verifying the parameters of a surface.

The SOLIDWORKS API automates and customize the SOLIDWORKS software.The API contains hundreds of functions that you can call from Visual Basic for Applications (VBA), VB.NET, Visual C#, Visual C++ 6.0 , and Visual C++/CLI. These functions provide direct access to SOLIDWORKS functionality such as creating a line, inserting an existing part into a part document, or verifying the parameters of a surface.

54 questions
2
votes
1 answer

Adding new members and extending methods in an external API interface

I am building an VB.NET application in Visual Studio using SOLIDWORKS API - my application connects to SOLIDWORKS application via COM, and performs some actions in it using various API calls. The API is accessed by adding project references to…
2
votes
1 answer

Creating a line in Solidworks VBA

I'm trying to run a very simple function that takes inputs for a two points and Solidworks makes a line from it. Dim swApp As Object Sub main() Set swApp = Application.SldWorks line = CreateLine(1, 1, 1, 0, 0, 0) End Sub Function CreateLine( _ …
Kevin D.
  • 104
  • 8
1
vote
0 answers

Unable to select named edges & faces using SelectByID2, and unable to use InsertMoldPartingLIne in the Soldiworks API

I am writing a Python script using the Solidworks 2022 API (via COM). I am trying to call the SelectByID2 method to select both a named edge and a named face for use in the InsertMoldPartingLine method. The InsertMoldPartingLine method requires the…
Mark
  • 11
  • 1
1
vote
0 answers

Loading ACIS file in solidworks with c# API

J'essaie d'automatiser le chargement de fichier SAT dans SolidWorks en faisant un Add-in. pour cela j'utilise LoadFile4 swPart = (PartDoc)mSldWorksApplication.LoadFile4(fileNameToWorkOn,"r", ImportData, ref m_LongStatus); Je n'arrive pas à lire le…
1
vote
0 answers

Extracting Data from a STEP file to add to a database

Can anyone help suggest the best way to extract properties from a step file without having to open the file in SOLIDWORKS or another third party viewer. I'm trying to add part design data to a database, such as overall dimensions / volume / mass /…
Philip
  • 11
  • 1
1
vote
1 answer

Solidworks API / Macro to create configuration with a "Description"

Is there a way to create a new configuration with something written into "description" of the configuration properties? i used AddConfiguration3 but there is no argument for "description" in it. Sub main() Dim swApp As SldWorks.SldWorks …
Dani El
  • 21
  • 3
1
vote
1 answer

How to find the name of the mate entity in an assembly

How can I find the name of a mate entity of a component in an assembly? That is, if a component is used twice in an assembly and has two coincident mates using the same face (of said component) with another component, can I extract a name that is…
user20650
  • 24,654
  • 5
  • 56
  • 91
1
vote
1 answer

Delete Solidworks drawing Detail view

I need to delete unnecessary detail views in specified Solidworks drawing, but I need to use late binding. First I try to delete Detail view from feature tree, but then it delete only Detail view leaving sketched circle. Then I delete Detail view in…
Guntis
  • 31
  • 3
1
vote
1 answer

Apply Solidworks macro to a selected bodies, not parts

I have an existing macro that I use to colorize the selected part on the assembly. But the limitation for this is when you select a body under a part, it treats it as one body and giving it one same color. Please see image below: I want to change…
Mark donne
  • 17
  • 5
1
vote
0 answers

Best way to handshake between VBA to Python

I'm trying to automate a program (solidworks) using python via VBA. I am executing the python script using shell32. However the problem I have is I want the VBA script to wait until the python script is done before it terminates. Right now the VBA…
Glutenberg
  • 11
  • 1
1
vote
1 answer

SolidWorks Addin Import STEP file to current document

I'm trying to import a .step file into my current assembly document using a custom C# addin. I can successfully open a .step file as a new document using the LoadFile4 method…
MOH Vaerks
  • 33
  • 4
1
vote
1 answer

Solidworks API and Winforms VB.NET swApp

Very similar to Solidworks API and Winforms C# swApp (Standalone) however I cant seem to get the Solution on my application working. I have made a Macro that creates a new drawing which runs, however then you get a winform that has two buttons, one…
StarLordBlair
  • 573
  • 1
  • 11
  • 27
0
votes
0 answers

When to use swApp as Object vs swApp as sldworks.sldworks?

I am brand new to Solidworks VBA. In Excel, I followed along the example of "Import STEP File Example (VBA)" and immediately received an error. The dim swApp as sldworks.sldworks and set swApp = Application.Sldworks returned a Runtime error '438':…
SML
  • 1
0
votes
0 answers

API - Custom property as evaluated result

Just a heads up but I’m not a programmer or API expert. I am using property tab builder to write a series of properties into my files. I’m then using a macro that then concatenates them nicely into a file name on my drawing sheet. Unfortunately, at…
Will
  • 1
0
votes
0 answers

Solidworks API SelectbyID2 variable ID Naming

Note I am very new at VBA and coding in Solidworks API in general. Explaining things very simply would be very helpful. I am trying to generate a part based off a set of points I've uploaded. Each of the points, when uploaded, is assigned a number…
brain
  • 1
1
2 3 4