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?
part file names
- Les Newell
- Site Admin
- Posts: 3680
- Joined: Thu May 11, 2006 8:12 pm
Re: part file names
Parts don't always include the drawing file name (e.g a copy won't) but something like this should work:
Code: Select all
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