Access geometry of part and add new

I would like to create a lua script that finds all points in all parts and then add a certain shape at its location. Is this possible? I have seen the Shape plugin can add geometry so I may find out how to add geometry. But can I extract the points? There seem to be no way to list methods or properties of a part object.

    local parts = sc.Parts:Get()
    for i = 0, count - 1 do
        local part = parts:op_index(i)
        print("Part index: ",i)
        print("Part operations: ", part.operations) --exists
        print("Part entities: ", part.entities) --nil
        print("Part objects: ", part.objects) --nil
        print("Part geometry: ", part.geometry) --nil
        print("Part name: ", part.name) -- exists
    end

That’s a fairly big task. In Windows explorer go to SheetCam’s install folder (usually something like c:\program files (x86)\Sheetcam TNG. In there open the SDK folder. The .i files are the definitions for all of the SheetCam specific Lua extensions. You can open them with any text editor. For instance part.i shows all of the methods of the Parts and Part objects. The actual part geometry is stored in the ‘groups’ member of the Part object.
When creating geometry copy the method used by the shape plugin. Directly modifying groups could have unexpected consequences.

I don’t know if it helps but you can use GetPosition on the part to get the center of the part. GetExtents will return the bounding box of that part.

Thanks. I managed to achieve what I wanted. Not fully satisfied with the positioning of the editable object when placed into the part but it works. Here is the code:

function OnStart(event)
    local parts = sc.Parts:Get()
    local count = parts:GetCount()

    for i = 0, parts:GetCount() - 1 do
        local part = parts:op_index(i)
        layers = part.layers
        layername = "transformed points"
        lidx = layers:NameToLayer(layername)
        if lidx == -1 then
            templayer = sc.Layer()
            templayer.name = layername
            layers:Add(templayer)
            lidx = part.layers:NameToLayer(layername)
        end
        groups = part.groups
        local groupcount = groups:GetCount()
        pts = {}
        maxx = -1e13
        minx = 1e13
        maxy = -1e13
        miny = 1e13
        partpos = part:GetPosition()
        for j = 0, groupcount - 1 do
            local group = part.groups:op_index(j)
            if group.isCircle and group:Length() == 0.0 then
                layer = part.layers:op_index(group.layer).name
                ctr = group.ctr
                maxx = math.max(maxx,ctr.x)
                minx = math.min(minx,ctr.x)
                maxy = math.max(maxy,ctr.y)
                miny = math.min(miny,ctr.y)
                pts[#pts + 1] = ctr
                group.layer = lidx
            end
        end
        if #pts > 0 then
            tempObj = sc.EditableObject("point replacements")
            tempObj:SetLayer(layer)
            tempObj:InsertIntoPart()
            tempObj:StartPaths()
            for _, pt in ipairs(pts) do
                local path = sc.Path()
                path.type = sc.PATH_ARC
                path.start:Set(pt.x+radius, pt.y)
                path.ctr:Set(pt.x, pt.y)
                path.startAngle = 0
                path.angle = 3*math.pi/2
                path["end"] = sc.Coord2D(pt.x,pt.y+radius)
                tempObj:AddPath(path)
            end
            tempObj:EndPaths()
            tpos = sc.Coord2D((maxx+minx)/2+partpos.x,(maxy+miny)/2+partpos.y)
            tempObj:SetPosition2D(tpos)            
            tempObj:Update()
        end
        --layers:Delete(lidx)
    end
end

(Edit: Fixed issue with minx etc. in the code)