• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

macro to add prefix / suffix on drawing quotas

  • Thread starter Thread starter romy
  • Start date Start date

romy

Guest
Good morning to all,

Is a macro possible to add a text, such as the symbol =, to the quotas of the design environment?

I often use it to indicate symmetric quotas and always do it by hand but a button that calls a macro would be convenient

Can anyone help me?

greetings
 

Attachments

  • Prefisso - Suffisso.webp
    Prefisso - Suffisso.webp
    4 KB · Views: 24
Good morning to all,

Is a macro possible to add a text, such as the symbol =, to the quotas of the design environment?

I often use it to indicate symmetric quotas and always do it by hand but a button that calls a macro would be convenient

Can anyone help me?

greetings
'**********************
'copyright(c) 2024 xarial pty limited
'reference: add equation to dimension using solidworks api'license: license
'**********************

dim swapp as sldworks.sldworks
dim swmodel as sldworks.modeldoc2
dim swselmgr as sldworks.selectionmgr

const prefix as string = "= "
const suffix as string = " ="

sub main()

set swapp = application.sldworks

set swmodel = swapp.activedoc

if not swmodel is nothing then

set swselmgr = swmodel.selectionmanager

dim swdispdim as sldworks.displaydimension

set swdispdim = swselmgr.getselectedobject6(1, -1)

if not swdispdim is nothing then
swdispdim.settext 1, prefix
swdispdim.settext 2, suffix
else
msgbox "please select dimension"
end if
else
msgbox "please open model"
end if

end sub

selezioni la quota e lanci la macro.

ho modificato questa
 

Attachments

Hello and thank you

works perfectly

Since you're there.... :-)

is it possible even in the box under the quota?

as from image?

Thank you.
 

Attachments

  • Casella testo.webp
    Casella testo.webp
    4.9 KB · Views: 18
Good morning.

thanks to all of you

tried both methods

a macro flaw is that the odds you have to select one by one

I don't know if you can change to have a multiselection with +ctrl

greetings
 
Masonic excuse

I didn't want to disrespect anyone

was not only given to me but to all users

of course everything is better

greetings
 
Hi giancarlo,

perfect you are a dragon

everything works and I have already customized it

I'll make it even harder...

Is it possible even on the hole captions?

I would like to add a splash to the last rigo of caption

greetings
 

Attachments

  • Didascalia.webp
    Didascalia.webp
    10.8 KB · Views: 19
Hi giancarlo,

perfect you are a dragon

everything works and I have already customized it

I'll make it even harder...

Is it possible even on the hole captions?

I would like to add a splash to the last rigo of caption

greetings
Changed quickly, keep in mind that the selection quotas are of various type so that even the addition of any texts must preserve the text already present.
Since you customized the others you can try to change this by helping with the solidworks bees help.
 

Attachments

Hello everyone,

I send the post as I used the macro politely made available to store it

But I noticed something:

when I apply the macro goes to erase the parameters of sw and practically explodes the parameters in simple text

this makes the not parametric notes and if I change for example the hole or lamatura measurement these do not update

is it possible to correct?

greetings
 

Attachments

  • Errore macro.webp
    Errore macro.webp
    78.5 KB · Views: 9

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top