Copy & Paste

Hey everyone,

I just had a circuit break on me after using copy&paste from within the editor.

More precisely, I united two working circuits into one schematic. The transition from one build view into the other felt smooth, but the resulting circuit cannot be simulated anymore.

Message within the editor: TypeError: string is not a function.

I'm new to circuitlab, but searching returned nothing on this one.

Any help is appreciated,

Sebastian.

by sek
March 06, 2012

Hmkay, seems like I solved it by debugging in three different browsers.

Chrome throws the above error message.

Firefox deviates by stating that 'b' is not a function.

Safari solves it by stating: 'R10' is not a function (evaluating 'b(NaN)').

And then I saw it: the editor did automatically rename every single component - except R10, it does exist twice. ;)

Still, two issues here: the error in the renaming/pasting algorithm and the confusing browser messages.

Cheers, Sebastian.

by sek
March 06, 2012

Hi sek,

Thanks for reporting this. In order to better help me track down the bug, could you point me to the two different circuits you copied from. I'm having trouble recreating the bug.

by hevans
March 06, 2012

Thanks for the reply.

I tried to paste this one:

into that one:

I've just tried again, it seems to be reproducible. R1 from the pasted circuit became renamed to R10 without it's existing R10 being renamed, too.

Thanks for looking into it,

Sebastian.

by sek
March 07, 2012

Hi sek,

It looks like neither of those circuits is public, so I can't get to them. If you could make them public I'd like to look into this issue.

by hevans
March 07, 2012

Done. Although I would have thought that you guys at CircuitLab would have other means to get into a circuit. ;)

I've applied changes to the circuits in the meantime, though. Thus the outcome might be different with the current versions.

But it's not difficult to create a test case. I've had it occur several times in the last couple of days. Just create two circuits with at least one mutual component designator. Increase the number of (common) part names, if necessary.

by sek
March 08, 2012

Hi @sek,

We pushed some changes yesterday that should not allow this copy/paste error to happen anymore, and if it does, the editor should at least give you a useful error message.

Let me know if this error is still happening.

by hevans
March 08, 2012

I now get the meaningful error message of a duplicate component 'R10' in the existing project. Also, duplicate designators no longer prevent the simulation mode from appearing.

The original problem of automatically creating duplicate names still persists, though. The algorithm appears to simply rename pasted duplicate component names, starting above the largest existing part number. It also appears to stop after no more conflicts with the existing components occur, ignoring newly created conflicts with other pasted components.

As an example, consider a circuit with two resistors R1 and R2. Copy those resistors, now paste them into the same circuit. The pasted resistors become named R3 and R4, which makes sense.

Now, cut R3 and R4 and rename either R1 or R2 into either R3 or R4. Paste again and see how oddity gets introduced. Now, if you continue this renaming and copying/cutting/pasting action, you can see how renaming choice depends on the history of naming and renaming within the circuit(s) involved.

Maybe there's an intention behind this behavior, but - seeing that it introduces ambiguity at least into my circuits - perhaps it's just a renaming algorithm that needs improvement... ;)

by sek
March 10, 2012

Wait, magic just happened! Turns out this seems to be a JS browser compatibility issue.

It worked in Firefox 9.

It almost works in Firefox 11 and Safari 5.1.3 (pasted components aren't highlighted for moving!).

It failed in Chrome some version prior 17.0.963.78, but an update was released just recently. After installing this it now works, too. ;)

But while we're at it: could you please have pasted components placed into an unused area of the circuit? As of now every pasting action renders every circuit unusable at first. Note that this would also defuse the highlighting issue.

Cheers, Sebastian.

by sek
March 10, 2012

Post a Reply

Please sign in or create an account to comment.