link sketch dimension with custom property

Programming and macros
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

link sketch dimension with custom property

Unread post by mp3-250 »

Using API I was able to fillet all the segments of a sketch, passing a custom property as radius.
This way only the numeric value I read from the custom property is passed and both the sketch dimension and the custom property remain independent, but what about linking them together?

Is it possible to link a dimension and a custom property e.g. during the fillet creation in the sketch?
what is the correct way to do it?
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: link sketch dimension with custom property

Unread post by gupta9665 »

Create a variable with some value. Now link the custom property and fillet values to that variable.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Re: link sketch dimension with custom property

Unread post by mp3-250 »

the sketch could be randomly deleted and recreated multiple times during the design phase.
Is it possible to name the fillet dimension the same way every time and keep the link?
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: link sketch dimension with custom property

Unread post by gupta9665 »

mp3-250 wrote: Mon Jan 22, 2024 4:29 pm the sketch could be randomly deleted and recreated multiple times during the design phase.
Is it possible to name the fillet dimension the same way every time and keep the link?
The complete dimension name in a sketch is dim name @ Sketch name. So you will have to rename both the sketch, and fillet dimension.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Re: link sketch dimension with custom property

Unread post by mp3-250 »

@gupta9665 thank you for the hint.

the sketch name does not change.
it is edited, segments wiped and replaced only, so I have its name under control.
how do I get the sketch fillet dimension after its creation?

I suppose I need and equation to link fillet dimension and the file property.
I tried to look for an example, but I cannot find what parmeters to pass and what API use.

If I have a "radius" property how do I equate with the sketch dImension?

in the UI it would be something like

"D1@sketch1"="radius"

is it the same for api as well?
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: link sketch dimension with custom property

Unread post by gupta9665 »

I read your post of the 3DSYM forums as well. ANd here is what I replied

You need to get the fillet dimension name after it has been created. And then link it with the property name and not it's value. So you will have to actually create an equation using the API.


Here is the line of code you may need

Part.GetEquationMgr.Add2 0, """D1@Sketch1"" = ""Radius""", True
Deepak Gupta
SOLIDWORKS Consultant/Blogger
Post Reply