Measure Total Combined Wireframe Edge Length

Measure Total Combined Wireframe Edge Length

mark18
Observer Observer
355 Views
1 Reply
Message 1 of 2

Measure Total Combined Wireframe Edge Length

mark18
Observer
Observer

Does anyone have a way to measure total combined wireframe edge length on a CAD model?

0 Likes
356 Views
1 Reply
Reply (1)
Message 2 of 2

kandennti
Mentor
Mentor

Hi @mark18 -San.

 

I don't know what a Wireframe Edge looks like, but I imagine that all edges are imported into a 3D sketch.
The following sample shows the total length of all curves in a given sketch.

# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion


def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        msg: str = 'Select Sketch'
        selFilter: str = 'Sketches'
        sel: core.Selection = select_ent(msg, selFilter)
        if not sel:
            return

        totallength = sum([c.length for c in sel.entity.sketchCurves])
        ui.messageBox(f'{totallength} Cm')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def select_ent(
    msg: str,
    filter: str
) -> core.Selection:

    try:
        app: core.Application = core.Application.get()
        ui: core.UserInterface = app.userInterface
        sel = ui.selectEntity(msg, filter)
        return sel
    except:
        return None


It would be helpful if you could attach a more specific f3d file.