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

Ruby GraphicsPath save error?

For general discussion related FlowStone

Ruby GraphicsPath save error?

Postby KG_is_back » Sat Oct 04, 2014 3:59 pm

Here is the thing. I want to pass a GraphicsPath form one ruby component to another but when I save the schematic I get an error "(in method 'saveState') no _dump_data is defined for Class GraphicsPath"
I believe the problem is, that the Path cannot be saved as part of inputs and outputs (which are saved and loaded by default in ruby). I do not need to save the path, but I need it to pass from one component to another. What should I do?
Attachments
pathproblem.fsm
(321 Bytes) Downloaded 808 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Ruby GraphicsPath save error?

Postby billv » Sun Oct 05, 2014 12:30 am

KG_is_back wrote:pass a GraphicsPath form one ruby component to another

What if you write the method inside a class like..

Code: Select all
class GraphicsPath

def rect
return [0,0,10,10]
end

end

# then in other ruby prim...

mypath = GraphicsPath.new
mypath.rect


Would this work for you ?
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby GraphicsPath save error?

Postby KG_is_back » Sun Oct 05, 2014 12:57 am

billv wrote:
KG_is_back wrote:pass a GraphicsPath form one ruby component to another

What if you write the method inside a class like..

Code: Select all
class GraphicsPath

def rect
return [0,0,10,10]
end

end

# then in other ruby prim...

mypath = GraphicsPath.new
mypath.rect


Would this work for you ?


Unfortunately that would not work. The example schematic contains the path contains only one rectangle just to show the problem. The path I'm using in my original schematic contains several shapes.
But it gave me an idea oh how to fix the problem. I do not really need to save the path - I just need to prevent the error massage to show. So what if I add a dummy "_dump_data" method to graphicsPath class that simply outputs nil. That should fool the FS not to show error. And similar thing would probably be needed for loading... I'll give it a try.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Ruby GraphicsPath save error?

Postby billv » Sun Oct 05, 2014 1:28 am

So its not viable/possible to just re write your
original inside the class and add all your shapes
inside new def's there....Ok....Hope you find right solution.
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby GraphicsPath save error?

Postby KG_is_back » Sun Oct 05, 2014 1:36 am

Yes!!! IT WORKS... it is something called marshal module...has functions _dump and _load to deal the saving and loading data... some classes do not have these functions defined, so they output error. I just added "dummy" versions of these methods GraphicsPath class and errors are gone

Code: Select all
class GraphicsPath

def _dump level
end
def _load args
end

end
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Ruby GraphicsPath save error?

Postby billv » Sun Oct 05, 2014 1:56 am

Great :) ..will take another look at Mr Marshall..interesting fix..
billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby GraphicsPath save error?

Postby RJHollins » Sun Oct 05, 2014 6:14 am

Ahh ... the 'Marshall' routine.

Mr NuBeat has done some extensive work on this very useful function.

I think NuBeat started to help me on this over at the SM forum. For what I needed to do, this 'Marshall' technique of saving and loading configuration data simplified the entire process and array management.

I continue to thank NuBeat for this, and all his other generous help and educating :D
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Ruby GraphicsPath save error?

Postby KG_is_back » Sun Oct 05, 2014 10:04 am

RJHollins wrote:Ahh ... the 'Marshall' routine.

Mr NuBeat has done some extensive work on this very useful function.

I think NuBeat started to help me on this over at the SM forum. For what I needed to do, this 'Marshall' technique of saving and loading configuration data simplified the entire process and array management.

I continue to thank NuBeat for this, and all his other generous help and educating :D

ah yes I remember that... it was something about array of arrays, that the top array contains only pointers to the sub-arrays. when you create a copy of the top array and change the element in the sub-array both copy and original will be affected. We needed the mashall routine to create a hard copy to make the copy and original change values separately.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Ruby GraphicsPath save error?

Postby RJHollins » Sun Oct 05, 2014 6:53 pm

One of the very handy features using the 'Marshall' routine had to do with variable sized array management. It automatically handle all those details.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Ruby GraphicsPath save error?

Postby RJHollins » Tue Oct 07, 2014 8:53 am

I went searching for the thread[s] both here and on SM for the 'Marshal Method' ... I couldn't find it :roll:

We were doing all kinds of testing to save/load files while dealing with some strange compatiability issue ... it was a real crazy time.

If I find the threads I'll try to post them.
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm


Return to General

Who is online

Users browsing this forum: No registered users and 101 guests