(2022-04-02, 19:47)Roland Melkert Wrote: 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.
So, either this doesn't work or I did it wrong (the latter is most likely!). Using the test function below, which should print only the currently visible ref lines, I instead get all of the ref lines:
Code:
function printVis()
local sf=ldc.subfile()
if not sf:isLinked() then
ldc.dialog.runMessage('No active session')
return
end
local cnt=sf:getRefCount()
for i=1, cnt do
local ref=sf:getRef(i)
if ref:getVisible() then
print(ref)
end
end
end
On your API guide, it does say that getVisible only pertains to animations, so perhaps it doesn't reflect buffer exchange status after all?
Attached here is a test file I'm using. If my script is successful, the finished model will display only the white pyramid, not any of the red or blue bricks, when opened in any LDraw viewer/editor.
bufExTest.dat (Size: 2.21 KB / Downloads: 1)