iovem
Guest
Bye to all,
I have a couple of macros that allow me to change the scale of a drawing with a button. a macro increases the scale, the other decreases it.
I noticed that at the change of scale, the spacing of quotas changes. happens only on the basic view and does not happen if the change of the scale takes place through the solidworks interface. I initially thought it was due to the subject
Moreover, in another macro, use
Thank you in advance who can help me.
attached you will find an example file and a short video where I follow the macro and on the basic view the spacing of the quota changes.
Here are the codes
e
I have a couple of macros that allow me to change the scale of a drawing with a button. a macro increases the scale, the other decreases it.
I noticed that at the change of scale, the spacing of quotas changes. happens only on the basic view and does not happen if the change of the scale takes place through the solidworks interface. I initially thought it was due to the subject
[I]scaleannoposition[/I] method setscale , but also setting true I get the same result.Moreover, in another macro, use
setupsheet5 to change the sheet size and also in this case passing as arguments the scale factor, the size move.Thank you in advance who can help me.
attached you will find an example file and a short video where I follow the macro and on the basic view the spacing of the quota changes.
Here are the codes
Code:
dim swapp as sldworks.sldworks
dim swdraw as sldworks.idrawingdoc
dim swsheet as sldworks.sheet
dim sheetproperties as variant
dim scalanum as double
dim scaladen as double
dim scaleannoposition as boolean
dim scaleannotextheight as boolean
dim value as boolean
sub main()
set swapp = application.sldworks
dim swdraw as sldworks.idrawingdoc
dim swsheet as sldworks.sheet
dim swmodel as sldworks.modeldoc2
set swmodel = swapp.activedoc
if swmodel is nothing then
msgbox ("open a drawing")
goto finally_
end if
if swmodel.getpathname() = "" then
msgbox ("save the file")
goto finally_
end if
if not swmodel.gettype() = swdocdrawing then
msgbox ("open a drawing")
goto finally_
end if
set swdraw = swapp.activedoc
set swsheet = swdraw.getcurrentsheet
sheetproperties = swsheet.getproperties2
scalanum = sheetproperties(2)
scaladen = sheetproperties(3)
if scalanum = 1 then
select case scaladen
case is = 1
scaladen = 1
scalanum = 2
case is = 2
scaladen = 1
case is = 2.5
scaladen = 2
case is = 4
scaladen = 2.5
case is = 5
scaladen = 4
case is = 7.5
scaladen = 5
case is = 10
scaladen = 7.5
case is = 15
scaladen = 10
case is = 20
scaladen = 15
case is = 25
scaladen = 20
case is = 30
scaladen = 25
case is = 50
scaladen = 30
case is = 75
scaladen = 50
case is = 100
scaladen = 75
case is = 150
scaladen = 100
case is = 200
scaladen = 150
case is = 250
scaladen = 200
case else
msgbox "scale not found", vbexclamation
goto finally_
end select
elseif scaladen = 1 then
select case scalanum
case is = 2
scalanum = 2.5
case is = 2.5
scalanum = 4
case is = 4
scalanum = 5
case else
msgbox "scale not found", vbexclamation
goto finally_
end select
end if
scaleannoposition = false
scaleannotextheight = false
value = swsheet.setscale(scalanum, scaladen, scaleannoposition, scaleannotextheight)
finally_:
end sub
e
Code:
dim swapp as sldworks.sldworks
dim swdraw as sldworks.idrawingdoc
dim swsheet as sldworks.sheet
dim sheetproperties as variant
dim scalanum as double
dim scaladen as double
dim scaleannoposition as boolean
dim scaleannotextheight as boolean
dim value as boolean
sub main()
set swapp = application.sldworks
dim swdraw as sldworks.idrawingdoc
dim swsheet as sldworks.sheet
dim swmodel as sldworks.modeldoc2
set swmodel = swapp.activedoc
if swmodel is nothing then
msgbox ("open a drawing")
goto finally_
end if
if swmodel.getpathname() = "" then
msgbox ("save the file")
goto finally_
end if
if not swmodel.gettype() = swdocdrawing then
msgbox ("open a drawing")
goto finally_
end if
set swdraw = swapp.activedoc
set swsheet = swdraw.getcurrentsheet
sheetproperties = swsheet.getproperties2
scalanum = sheetproperties(2)
scaladen = sheetproperties(3)
if scalanum = 1 then
select case scaladen
case is = 1
scaladen = 2
case is = 2
scaladen = 2.5
case is = 2.5
scaladen = 4
case is = 4
scaladen = 5
case is = 5
scaladen = 7.5
case is = 7.5
scaladen = 10
case is = 10
scaladen = 15
case is = 15
scaladen = 20
case is = 20
scaladen = 25
case is = 25
scaladen = 30
case is = 30
scaladen = 50
case is = 50
scaladen = 75
case is = 75
scaladen = 100
case is = 100
scaladen = 150
case is = 150
scaladen = 200
case is = 200
scaladen = 250
case else
msgbox "scale not found" , vbexclamation
goto finally_
end select
elseif scaladen = 1 then
select case scalanum
case is = 1
scalanum = 1
scaladen = 2
case is = 2
scalanum = 1
case is = 2.5
scalanum = 2
case is = 4
scalanum = 2.5
case is = 5
scalanum = 4
case else
msgbox "scale not found" , vbexclamation
goto finally_
end select
end if
scaleannoposition = false
scaleannotextheight = false
value = swsheet.setscale(scalanum, scaladen, scaleannoposition, scaleannotextheight)
finally_:
end sub[ICODE]