Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Get Object Location

For general discussion related FlowStone

Get Object Location

Postby aronb » Sun Mar 14, 2021 8:09 pm

Hi,

I need to find the location of an object inside a view, that I place somewhere in that view.

The example here, shows the text (label) location in the view, but how do I get that location point out of the view?

Also... can I get back any objects location?

The end goal for now, is to be able to use the "area AND the location" of the text, to create a clipping area to allow the text to be over another object in the view, and clip / exclude that object, to allow the text to make that area clear (in this example).

I can of course get the width and height, but how do get an objects location in the final view???

Object_Text_Loaction.fsm
Need Object Location Information
(4.21 KiB) Downloaded 842 times


Thanks for any help,

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA

Re: Get Object Location

Postby aronb » Mon Mar 15, 2021 1:17 am

P.S.

You can see that information during and while positioning objects... the trick is how do I get at it?
In this example "Label wOptions v1 (5,5) sqr" is shown, and is the upper left corner of the insert point.

Text_Position.png
Position
Text_Position.png (18.06 KiB) Viewed 11010 times


Thanks Again!

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA

Re: Get Object Location

Postby adamszabo » Mon Mar 15, 2021 8:16 am

If you read the user manual, in the text section it says, you can get the area a text is occupying with Ruby, and you can use that to clip your line behind the text. Read the part about "v.measureString" you need to use that
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Get Object Location

Postby aronb » Tue Mar 16, 2021 6:05 pm

Yes of course,

You can even create (in Ruby) a rectangle to put the text in - I.E. "v.drawString @label,font,sf,rect,(Brush.new @color)", but again you can't seem to get at the LOCATION of that text in the MGUI...?

Again the idea here, is getting to the position data of the object of each item in the MGUI during the unlock, edit placement time. Yes you can get an items size, but seemingly not its location :?

Of course we / I could just create all of it in Ruby (text and rounded rectangle), but a better way would be able to get the object location coordinates (size is easy), and then be able to use that data for calculating the front panel or GUI.

Programming the whole thing again is great, but just pulling in something from the toolbox as needed makes more sense to me... that way, its not a custom module, it is a generic module made of prims or other modules.

Hope that makes sense :)

Thanks for the input!!!

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA

Re: Get Object Location

Postby tulamide » Tue Mar 16, 2021 8:06 pm

While you don't get it served on a golden plate (which would be great), it should be possible. You just need to think in reverse, from bottom to top.

The prim "View Area" outputs the area of the current view. The prim "Area to Float" gives you access to its components as float values, namely x, y, width and height. Whenever this view is placed in another view (and the chain of view inputs on the MGUIs is intact), x and y will be local to that other view.

For Ruby, the same thing is available. It is a method called "getViewPos" and contains [x, y] and "getViewSize", which contains [width, height]. I'm not sure though if getViewPos was already implemented in 3.0.6, so you might want to try it with the newest alpha?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: Google [Bot] and 95 guests