Les,
I’m attempting to make an enhanced Autoload plugin that will iterate through each part in the Parts tree and compare its filename to the one detected. If it’s a match, then, select the part, else, add a new part to the list, select it, then do the LoadDrawing operation.
Can you give me the syntax for the part filename property?
Parts don’t always include the drawing file name (e.g a copy won’t) but something like this should work:
function LoadFile(fileName)
local parts = sc.Parts:Get()
for idx=0, parts:GetCount() -1 do
local part = parts:op_index(idx)
if fileName == part:GetFileName() and not part:IsDuplicate() then
parts.Selected:Set(part)
part:Load(fileName)
return
end
end
local part = parts:AddNew()
part:Load(fileName)
end