Jump to content
Developer Wiki and Function Reference Links ×

Getunits gives the wrong area units


maarten.

Recommended Posts

When i use GetUnits in combination with ObjArea, i get the wrong units.

GetUnits give me the wrong units. They give me the curent unit mark and puts a "2" after it.

for example:

units are in mm

square units are in m2

I draw a pio that's 1m2 big, the PIO will give me this information:

1mm2

The same thing happens when i use GetPrefString(158).

Anybody an idea what i do wrong?

If it isn't clear what i'm talking about:

eenhedenns9.png

Here's the code:

PROCEDURE Test;

VAR

resultaat : BOOLEAN;

pioNaam : STRING;

pioHandle : HANDLE;

pioRecord : HANDLE;

pioMuur : HANDLE;

h : HANDLE;

PioPad : HANDLE;

poly : HANDLE;

opp : REAL;

oppS : STRING;

fraction : LONGINT;

display : LONGINT;

format : INTEGER;

upi : REAL;

name : STRING;

squareName : STRING;

BEGIN

resultaat:=GetCustomObjectInfo(pioNaam,pioHandle,pioRecord,pioMuur);

PioPad:=GetCustomObjectPath(pioHandle);

h:=CreateDuplicateObject(PioPad,poly);

opp:=ObjArea(PioPad);

GetUnits(fraction, display, format, upi, name, squareName);

oppS:=ConCat(Num2Str(2,opp),squareName);

CreateText(oppS);

END;

Run(Test);

Link to comment

I think i've found my faulth, GetPrefString(158) should have been GetPrefString(178).... My poor knowledge of techincal English has caused me trouble ones again :mad:

[font:Times New Roman]PROCEDURE GetUnits

( VAR fraction :LONGINT;

VAR display :LONGINT;

VAR format :INTEGER;

VAR upi :REAL;

VAR name :STRING;

VAR squareName :STRING

) ;[/font]

I still have no idea where this [font:Times New Roman]squareName[/font] stands for in this function... Where does VS get this information cause i think it's wrong... Same with GetPrefString(158), where does VS get this info, for i can't find where i can change this setting.

Link to comment

In the US version of VW2008, I think these are set in the File Menu, Document Settings, Units.

The 158 pref is getting something based on the Length setting in the general display. It returns the square of whatever unit you have selected.

The 178 pref is based on the area setting in the same dialog box.

The squareName is just the name of the base length with a sq in front of it (at least in English). This might be different in other localizations.

Pat

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...