Search found 21 matches

by Kjara
Wed Apr 19, 2023 3:58 am
Forum: How To Questions
Topic: make mate with reference planes robust against component replacement
Replies: 0
Views: 904

make mate with reference planes robust against component replacement

I will first explain my problem on a concrete example and later explain what I need to achieve in a real-life context. I have an assembly mateAssembly . It contains a suppressed component planeId27 : grafik.png That component/file has a plane with id=27 and name Plane1 : grafik.png There is a mate (...
by Kjara
Mon Oct 10, 2022 8:33 am
Forum: API
Topic: How to delete an IModelView
Replies: 1
Views: 419

How to delete an IModelView

When I open an IModelDoc2 invisibly, then call IModelDoc2.Extension.GetModelViews , I get returned Nothing / null . When I make the model doc visible via IModelDoc2.Visible = true and call IModelDoc2.Extension.GetModelViews again, I now get an array with one entry of IModelView . How do I delete tha...
by Kjara
Fri Oct 07, 2022 8:46 am
Forum: API
Topic: create design table in part or assembly
Replies: 1
Views: 470

create design table in part or assembly

How do I create a design table in a part or assembly document via SolidWorks API? I tried to find anything in the API docs, but IDesignTable interface lists only IModelDoc2.GetDesignTable as an accessor. Typing "design table" in the index also gives no useful results: The only useful I fin...
by Kjara
Fri Oct 07, 2022 7:39 am
Forum: API
Topic: freeze SolidWorks graphics updates
Replies: 1
Views: 585

freeze SolidWorks graphics updates

Is there a way to freeze SolidWorks graphics updates? I am not talking about freezing graphic updates of a certain IModelDoc2, which can be achieved using IModelView.EnableGraphicsUpdate and IFeatureManager.EnableFeatureTree . I am talking about the SolidWorks level, where a user can see e.g. if a f...
by Kjara
Fri Oct 07, 2022 7:24 am
Forum: API
Topic: API command for "make assembly from part"?
Replies: 4
Views: 481

Re: API command for "make assembly from part"?

RunCommand with swCommands_MakeAssemblyFromPartAssembly is, according to the API docs, what is internally called when clicking "make assembly from part". Since it opens the "Begin Assembly" PropertyManager page, this does not go without the user noticing. Too bad! -> Or is there ...
by Kjara
Thu Oct 06, 2022 7:48 am
Forum: API
Topic: API command for "make assembly from part"?
Replies: 4
Views: 481

API command for "make assembly from part"?

Is there an API method for this user action? grafik.png I know I can create a new assembly via ISldWorks.NewDocument(...) and then add a new component via IAssemblyDoc.AddComponent5(...) . But since IAssemblyDoc.AddComponent5(...) does not work if the IAssemblyDoc is invisible, which is a requiremen...
by Kjara
Tue Oct 04, 2022 3:05 am
Forum: API
Topic: SOLIDWORKS add-ins in .NET Core/.NET6 and DLL versions conflict
Replies: 1
Views: 1321

Re: SOLIDWORKS add-ins in .NET Core/.NET6 and DLL versions conflict

Regarding .net6: If COM registration does not work, try adding the following property to the project file (i.e. into some <PropertyGroup>): <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> Microsoft docs say about it: The CopyLocalLockFileAssemblies property is useful for plugin proje...
by Kjara
Tue Oct 04, 2022 3:04 am
Forum: API
Topic: Swx API for .netcore3.1 or .net5 or .net6
Replies: 2
Views: 903

Re: Swx API for .netcore3.1 or .net5 or .net6

Regarding .net6: If COM registration does not work, try adding the following property to the project file (i.e. into some <PropertyGroup>): <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> Microsoft docs say about it: The CopyLocalLockFileAssemblies property is useful for plugin proje...
by Kjara
Thu Sep 29, 2022 4:47 am
Forum: API
Topic: Get pattern component based on its position/coordinates
Replies: 0
Views: 707

Get pattern component based on its position/coordinates

I have some component pattern (e.g. ILocalLinearPatternFeatureData , ILocalCircularPatternFeatureData ; there are more). I want to reference a certain component in that pattern in a way that I can - determine if it currently exists based on the current instances in all possible dicrections; - if it ...
by Kjara
Tue Sep 20, 2022 7:34 am
Forum: API
Topic: control component suppression and configuration depending on assembly's configuration
Replies: 1
Views: 416

Re: control component suppression and configuration depending on assembly's configuration

For component suppression one could use IFeature.SetSuppression2 on the component feature (use IAssemblyDoc.FeatureByName on the component name to get the component feature). But it only works if the component feature is selected prior to calling IFeature.SetSuppression2 , and it does not work for p...
by Kjara
Mon Sep 19, 2022 4:50 am
Forum: API
Topic: change design table settings in invisible document without permanently making it visible
Replies: 0
Views: 772

change design table settings in invisible document without permanently making it visible

I have an invisibly-opened document that has a design table. I want to change some design table settings, namely those: IDesignTable.AutoAddNewConfigs IDesignTable.AutoAddNewParams IDesignTable.EnableCellDropdownLists IDesignTable.Updatable According to the API help, I can do this by first getting t...
by Kjara
Mon Sep 19, 2022 3:37 am
Forum: API
Topic: control component suppression and configuration depending on assembly's configuration
Replies: 1
Views: 416

control component suppression and configuration depending on assembly's configuration

Much data is configuration-dependent and has corresponding API methods that allow the programmer to choose which configurations should be affected. Examples: Dimension value – IDimension.SetValue3 Feature suppression – IFeature.SetSuppression2 Component Bom Exclusion – IComponent2.SetExcludeFromBom2...
by Kjara
Wed Sep 14, 2022 6:56 am
Forum: API
Topic: Get doc active configuration no matter what is loaded
Replies: 1
Views: 371

Get doc active configuration no matter what is loaded

I want to retrieve the active configuration of a model document given by its target file path. And I want to always retrieve the value that is saved in the file, no matter what files are currently open/loaded. How do I do that WITHOUT closing/reopening files before retrieving? I tried using - ISldWo...
by Kjara
Thu Jul 14, 2022 2:29 am
Forum: API
Topic: System.Text.Json in SolidWorks Addin (.NET Framework 4.8) gives runtime exception
Replies: 1
Views: 1018

Re: System.Text.Json in SolidWorks Addin (.NET Framework 4.8) gives runtime exception

I also asked this question on StackOverflow, stating some further thoughts and subquestions:

https://stackoverflow.com/q/72978989/5333340

It already contains a workaround (manually loading the missing assembly) and in the comments some hints to why the issue occurs in the first place.
by Kjara
Thu Jul 14, 2022 1:53 am
Forum: API
Topic: System.Text.Json in SolidWorks Addin (.NET Framework 4.8) gives runtime exception
Replies: 1
Views: 1018

System.Text.Json in SolidWorks Addin (.NET Framework 4.8) gives runtime exception

I built a sample Swx Addin in .NET Framework 4.8. I checked that it can be registered, unregistered, and that it runs in SolidWorks, showing a greeting / goodbye message on addin load / unload. Then I added a call to System.Text.Json.JsonDocument.Parse(…), which results in the following runtime exce...
by Kjara
Fri Jun 10, 2022 3:49 am
Forum: API
Topic: derived configurations: how to find out which ones in the tree drive a given parameter
Replies: 1
Views: 425

Re: derived configurations: how to find out which ones in the tree drive a given parameter

It seems that using IConfiguration.GetParameters or IModelDoc2.GetConfigurationParams returns a list of parameters, which I can then check for the presence of my given parameter. If it is present, I know it is controlled in the configuration, and vice versa. However, the API helps says for both meth...
by Kjara
Fri Jun 10, 2022 3:00 am
Forum: API
Topic: derived configurations: how to find out which ones in the tree drive a given parameter
Replies: 1
Views: 425

derived configurations: how to find out which ones in the tree drive a given parameter

I have a configuration tree with top-level configuration(s) and derived configuration(s), arbitrarily nested. For a given configuration (of any level) and a given parameter, I want to find out which configurations in the tree (root = given configuration) control the parameter. How do I do that? Note...
by Kjara
Mon Jan 31, 2022 3:06 am
Forum: API
Topic: Swx API for .netcore3.1 or .net5 or .net6
Replies: 2
Views: 903

Swx API for .netcore3.1 or .net5 or .net6

We are thinking about switching our software development from .net framework to a newer .net version (core or 5.0 or 6.0) since framework is not going to be developed further (so it's going to be dead at some point). Since we write quite a lot Swx addins and standalone projects (where Swx is remotel...
by Kjara
Fri Dec 03, 2021 4:46 pm
Forum: API
Topic: set hole wizard hole size for given configuration scope
Replies: 9
Views: 1444

set hole wizard hole size for given configuration scope

I have a part with more than 1 configuration, and I have a hole wizard hole in that part. I want to set the hole size for a given configuration scope (this/all/specific), just like one can do with dimensions using IDimension.SetValue3 . So I'm basically looking for a method like IDimension.SetValue3...
by Kjara
Fri Dec 03, 2021 4:39 pm
Forum: API
Topic: set weldment angle for given configuration scope
Replies: 0
Views: 518

set weldment angle for given configuration scope

I have a part with more than 1 configuration, and I have a structural member in that part. I want to set the angle for a given configuration scope (this/all/specific), just like one can do with dimensions using IDimension.SetValue3 . So I'm basically looking for a method like IDimension.SetValue3 , ...
by Kjara
Mon Jul 19, 2021 10:34 am
Forum: API
Topic: Focus Selected Component in FeatureTree
Replies: 0
Views: 1111

Focus Selected Component in FeatureTree

I have an IComponent2 and select it using IComponent2.Select4. I want it to be focused in the bottom pane of the feature tree, meaning that - if the component cannot be seen due to collapsed ancestor components, those should be expanded. - if it is out if sight (i.e. too far above/below/right/left o...