[split] Buffer Exchange cleanup script


RE: Simple LDCad script
#4
(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.

.dat   bufExTest.dat (Size: 2.21 KB / Downloads: 1)
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: 2 Guest(s)