[split] Buffer Exchange cleanup script


RE: Simple LDCad script
#2
(2022-04-02, 3:42)N. W. Perry Wrote: Hmm, so the logic of buffer exchange is a little trickier than I thought. It's easy enough when there's just one block of store/retrieve statements—just hide everything between the first store and the last retrieve. But when there are multiple hidden blocks with some visible lines in between them, it's harder.

I'm not completely sure without testing myself (been awhile since I wrote the relevant code) but I think you can use ref:getVisible to test if the line is currently visible inside LDCad's editor.

Downside is this function is only available on reference lines, and as you are looping all lines you will probably be working with the generic srcLine object.

You can determine a line to be a reference line by using srcLine:isRef but this still doesn't give you access to a refLine object. (you just gave me the idea to add an 'asRefLine' function to srcLine Smile )

A possible workaround for this could be to also load all references and setup a mapping table to find the reference with the same getLineIndex value the current srcLine has.

Alternative to all this would be to implement the buffer exchange rules while looping the lines.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Simple LDCad script - by Roland Melkert - 2022-04-02, 19:47
RE: Simple LDCad script - by N. W. Perry - 2022-12-24, 14:25
RE: Simple LDCad script - by Roland Melkert - 2022-12-28, 22:00
RE: Simple LDCad script - by N. W. Perry - 2022-12-28, 23:14
RE: Simple LDCad script - by Roland Melkert - 2022-12-29, 19:28
RE: Simple LDCad script - by N. W. Perry - 2022-12-30, 0:25
RE: Simple LDCad script - by N. W. Perry - 2022-04-03, 3:16

Forum Jump:


Users browsing this thread: 3 Guest(s)