Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
michaelk

Prefs

Recommended Posts

I'm going to wade in over my head again...

I took a new blank document in 2011 and saved it as VS.

I understand most of the SetPrefs. I almost see how SetUnits(a,b,c,d,'"',' sq ft') works. Playing around with those settings and reimporting is very amusing.

I can't find the setting for the foot marker (single quote). Can someone shed some light on this for me?

thanks

mk

Share this post


Link to post

Thanks Josh.

I'm slowing making minuscule progress....

But where is the foot mark defined?

mk

Share this post


Link to post

The unit mark is defined under the "name" variable in the SetUnits definition:

PROCEDURE SetUnits(fraction:LONGINT; display:LONGINT; format:INTEGER; upi:REAL; name:STRING; squareName:STRING);

It is usually defined as 2 single quotes and because it is a string it has to be enclosed by a pair of single quotes so you will see 4 single quotes together as in , ' ' ' ' , (without any spaces).

Share this post


Link to post

Michael,

???The unit mark for inches is a double quote, and not two single quotes next to each other.

???In Pascal strings, the single quote is used as the string delimiter, one at either end of the string. Everything in between is considered text. If you want to use a single quote inside your text, then you have to do something to tell the compiler that a single quote should not be used as a delimiter and should be used as text. Using 2 single quotes together inside the string will translate to 1 single quote in the output, and the compiler will not try to terminate your string when it sees the first single quote in the pair of single quotes.

e.g., Don't fence me in. is expressed as a Pascal string as: 'Don''t fence me in.' Note the 2 single quotes in Don''t. Now, if you remove all the letters, so that you only have the single quote remaining in the string you will get: ''''. That's 4 single quotes, 2 for delimiters and 2 for the single quote itself, and not to be confused with a double quote surrounded by single quotes. '"' They look identical in the font on my screen, but they are not. To tell the difference, walk your cursor through the text. Four characters vs. three characters.

HTH,

Raymond

Share this post


Link to post

Thank you maarten. I was just going to suggest that. More typing to enter it, but a LOT less trouble to try and figure out if it is double/triple/quad later when debugging.

Share this post


Link to post

:D OK - I should have been more specific.

What if I want to change the unit mark for feet?

It works for inches. Changing SetUnits(a,b,c,d,'"',' sq ft') to SetUnits(a,b,c,d,'@',' sq ft') makes @ be the inches symbol instead of ".

I'm interested to see if it is possible to change the feet symbol ' (single quote).

I'll attach a file...

Am I barking up the wrong tree?

mk

Share this post


Link to post

Is this something you want to do as part of a script? If so, it will be:

SetUnits(0, 3, 0, 1/12, 'ft', 'sq ft');

To change the unit mark to "ft" in VW directly:

1. Select the feet units to populate the custom dialog

2. Select custom units and click on the button next to the popup

3. Change the unit mark to ft, select Larger from Smaller (12 inches per Unit), and click OK

Share this post


Link to post

Wow. That blows my mind a little bit....

I never thought of doing it that way..

My goal started in response to someone else's post. He wanted to change the default format from 4'2" to 4' - 2" in a worksheet.

So I started looking for the vectorscript that sets the inch and foot marks. My vectorscript skills are still pretty limited, so I always convert documents to vs to get an idea of how it works.

So I found the inch mark (")

But I still don't understand where the foot mark (') comes from.

Or why dimension objects are in the format xx'-xx" and dimensions in worksheets are xx'xx"

I guess was expecting to find a SetUnits(a,b,c,d...''''...,'-','"',' sq ft') where the marks for feet, the dash, and inches were specified...

mk

Share this post


Link to post

The "Old style feet and inches" setting is a bit of a unique case. When you think about it, feet and inches is really the only setting that mixes units instead of using decimals and fractions. One would print 1.5cm, for example, never 1cm-5mm. Because it's so specific, I don't think you have the fine control with VS and using mixed units.

As for the worksheet, feet and inches have always been displayed this way. As far as I know, the only way to get the "-" is through a formula that concatenates in the character.

-Josh

Share this post


Link to post

Josh

It's crazy that we are still measuring things in units based on King Henry I's foot.

The concat trick works - except for fractions... (at least, I couldn't write a concat that would display fractions as fractions....)

So, should I assume that there is no VS setting for the foot mark and the dash between feet and inches?

mk

Share this post


Link to post

See http://developer.vectorworks.net/index.php?title=VS:Function_Reference_Appendix#Primary_Units_Selectors

I haven't tried it, but I believe you're after Unit Mark, Sunit Mark, and Sunit Divider. Unless someone here can shed some light, there's no way of knowing which VW version allowed access to these preferences.

And yes, the GetPref commands often offer granular, redundant access to settings you can retrieve with other VS commands.

-Josh

Edited by JBenghiat

Share this post


Link to post

Dear Maarten,

Is possible you share the information from irregular flagstone hatch.

I like development something like this but in the way classic mosaic.

My email is z.alves@oninet.pt

Best regards

LINE

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×