Jump to content

calculation with recordsheet values that doesn't make sense to me (0,250*1000 =2,0 and not 250)


Recommended Posts

I want to read out the size of German void Objects (Schlitze & Durchbrüche).

Afaik it's a float variable in the record format 'Break Opening CW','Delta_x''Break Opening CW','Delta_y', 'Break Opening CW','Delta_z'

I don't want to read out the numbers in 0,xxx meters but in xxx cm. So i multiply the value by 1000.

 

however the result from the script operation is never xxx but always either 0,xxxxxxxx-e01m or x (also all void objects do have a 0,xxx size and I multiply that 0,xxx size by 1000)

 

I also created a worksheet, which reads out the same variables.

='Break Opening CW'.'Delta_x'*1000

='Break Opening CW'.'Delta_y'*1000

='Break Opening CW'.'Delta_x'*1000

here the multiplication does work instead 

2084655650_Bildschirmfoto2022-07-06um15_32_10.png.569d73f1ddc0a6d5acaa4ba6ced0046f.png

 

131406631_Bildschirmfoto2022-07-06um15_33_23.png.8122a1b9b3d69f49323823c41f0d5252.png1643955291_Bildschirmfoto2022-07-06um15_33_28.png.d2dd4ee8dacd3cb294ff0a57e2833fcb.png

that's so strange to me. 0,250*1000 should be 250 and not 2,00, 0,500*1000 should be 500 and not 5,00...

I tried a lot, Num2StrF, Num2Str(0,...), multiplication by 1000000, no multiplication,... every time I use Num2Str 0,xxx changes in x.

I don't really understand, what's going on there...

 

( i also attach the vwx 2022 SP3 file)

 

 

def parentobjectcheck(SDBH):
	HNDL=vs.GetParent(SDBH)

	SDBx = vs.GetRField((SDBH),'Break Opening CW','Delta_x')
	SDBx = vs.Num2Str(2,SDBx*1000)
#	SDBx = vs.Round(SDBx)

	SDBy = vs.GetRField((SDBH),'Break Opening CW','Delta_y')
	SDBy = vs.Num2Str(2,SDBy*1000)
#	SDBy = vs.Round(SDBy)

	SDBz = vs.GetRField((SDBH),'Break Opening CW','Delta_z')
	SDBz = vs.Num2Str(2,SDBz*1000)
#	SDBz = vs.Round(SDBz)
	vs.SetRecord(SDBH, 'DB-BAUTEILKUERZEL')
	vs.SetRField((SDBH),'DB-BAUTEILKUERZEL','01 Bauteilkuerzel',(vs.Concat(SDBx,'-',SDBy,'-',SDBz)))

vs.ForEachObject(parentobjectcheck,"(INSYMBOL & INOBJECT & INVIEWPORT & (PON='Break Opening CW'))")

 

void-dimensions.zip

Link to comment

vs.GetRField always returns the String value of the field and appears to be returning the unit mark as well. Str2Num does not handle the unit mark for that you need to use vs.ValidNumStr.

 

Something like this seems to work.

 

	SDBx = vs.GetRField((SDBH),'Break Opening CW','Delta_x')
	B1, SDBxR = vs.ValidNumStr(SDBx)
	SDBx = vs.Num2Str(2,SDBxR*1000)

 

  • Like 1
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...