Style Stroke Width problem

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
dkwroot
Posts: 659
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Style Stroke Width problem

Post by dkwroot » Sat May 26, 2018 4:10 am

When looking at the 'M_Style' class, I noticed that the property 'fLineWidth' doesn't match the width in the UI. For example, when I give a shape a width of 4 in the UI and then print 'fLineWidth' for the style, I get 0.005555...

What I'm trying to do, is set the style stroke style width using a script, but I'm having trouble do to this issue. Am I accessing the style width incorrectly or is there a specific function that I should use?
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Style Stroke Width problem

Post by synthsin75 » Sat May 26, 2018 4:20 am

Try multiplying the 'fLineWidth' by: moho.document:Height()

Style width is scaled to the project dimensions.
dkwroot
Posts: 659
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Style Stroke Width problem

Post by dkwroot » Sat May 26, 2018 4:24 am

Perfect! When setting the fLineWidth, I just need to take the new input and divide it by the document height. Thanks, Wes.
User avatar
synthsin75
Posts: 7103
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Style Stroke Width problem

Post by synthsin75 » Sat May 26, 2018 4:27 am

No problem. Luckily I had to do this recently, so it was still fresh in my mind.
Post Reply