Style Stroke Width problem

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

Moderators: Víctor Paredes, Belgarath, slowtiger

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

Style Stroke Width problem

Post by dkwroot »

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: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Style Stroke Width problem

Post by synthsin75 »

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

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

Re: Style Stroke Width problem

Post by dkwroot »

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: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Style Stroke Width problem

Post by synthsin75 »

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