I have isolated the problem and recognize that it results because I don't 
know how to resize the world.  I decided to resize patches in my extension, 
which also involves rescaling drawings that I place over the world 
(guidelines for measures and music voices).

Here is how I have attempted to resize the world after I have changed 
P.PATCHSIZE or its pycor.  This appears to disappear (infinite recursion?) 
in ws.setDimensions(). * Is there a more standard way to resize the world 
within an extension?*  I've seen some ideas in ImporterJ.java, but have not 
yet got these to work.    Thanks!

 
    public static void resizeWorld(Context context)
            throws ExtensionException {

        ExtensionContext ec = (ExtensionContext) context;
        Workspace ws = ec.workspace();
        ws.setDimensions(new
                        WorldDimensions3D(0, P.XMAX - 1, 0,
                        P.YMAX, 0, 1,
                        P.PATCHSIZE,
                        P.WRAP, P.WRAP, P.WRAP),
                P.PATCHSIZE);
        World w = ws.world();

        // w.patchSize(P.PATCHSIZE);
        //ws.resizeView();  // not in event thread
        //ws.setDimensions(w.getDimensions(), P.PATCHSIZE);

        int pcoloridx = getPcolorID(w);

        initDrawing(w, ec);
        updateAgentsPositions(w);
    }


On Tuesday, October 1, 2019 at 2:31:48 PM UTC-4, Jeremy Baker wrote:
>
> Sven,
>
> Thank you for the update, glad you got your problem resolved.  Feel free 
> to reach back out if you have any other issues, it sounds like a very 
> interesting extension!
>
> -Jeremy
>
> On Tuesday, October 1, 2019 at 12:42:01 PM UTC-5, Sven Anderson wrote:
>>
>> I was able to pinpoint that it is due to a later custom command that 
>> changes PATCHSIZE.  I have enough to probably solve this myself.  Sorry!
>>
>> On Monday, September 30, 2019 at 12:03:30 PM UTC-4, Sven Anderson wrote:
>>>
>>>
>>> I've added a large number of additional functions (in Java) to the 
>>> original Sound extension to support visual music composition.  When I call 
>>> a regular NetLogo method, setup, within which I call clear-all and my own 
>>> sound:init() method which modifies the world's size, draws various lines, 
>>> and adds a set of time-locked Turtles to represent drums and voices, I find 
>>> that all code in sound:init() completes, but the call does not return, as 
>>> if there were some infinite loop or recursion.  If, however, I first call 
>>> my sound:init() from the Command Center, then there is no problem using the 
>>> setup command later.
>>>
>>> I'm having a hard time debugging this and was wondering if these 
>>> symptoms indicate the nature of my error?
>>>
>>> Thanks!
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/4257986d-5c53-4cb0-9ee4-93c5bfd400e8%40googlegroups.com.

Reply via email to