BRepEdgeVector

BRepEdgeVector

MichaelT_123
Advisor Advisor
333 Views
6 Replies
Message 1 of 7

BRepEdgeVector

MichaelT_123
Advisor
Advisor

Hi TF360,

 

FYAttention!

The documentation seems to be missing the description of the BRepEdgeVector Object

 

Regards

MichaelT

MichaelT
0 Likes
334 Views
6 Replies
Replies (6)
Message 2 of 7

kandennti
Mentor
Mentor

In addition to BRepEdgeVector, there are many other types that return xxxVector.

 

As I’m sure you’re aware, it would be helpful if the documentation mentioned that you can use list() to convert the data and check its contents.

Message 3 of 7

MichaelT_123
Advisor
Advisor

Hi Kandennti-San,

 

It would be even better if there were an ability to deal with the class directly in situ.

 

Regards

MichaelT

MichaelT
Message 4 of 7

BrianEkins
Mentor
Mentor

None of the xxxVector types you see in the debugger are defined as unique types in the API. The API is defined using a language-agnostic definition. When Fusion is built, it uses this definition to generate the C++ API. Then the API definition is used to create the Python and TypeScript wrappers over the C++ interface. The xxxVector objects are a side effect of how the Python wrapper is created for arrays. They support enumeration, so in most cases you don't even notice they're this weird type. But in the cases where you want a Python list, you can easily convert them, as Kandentti mentioned earlier.  

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 7

MichaelT_123
Advisor
Advisor

Hi Mr Brian Ekins,

 

It is my understanding of how the F360 Wrapper on the Core Code is constructed.

Regarding my 'frivolous' post about BRepEdgeVector, I cannot remember exactly what triggered it; perhaps I was referring to some 'ghost' entity I found in the debugger.

It is not a life-threatening issue, though!

 

Additionally, vector-driven geometry is a common, sophisticated mathematical concept to deal with and understand.

It was potentially... another trigger.

 

To explain the issue shortly further, consider a Line3D object. In F360, it is represented by startPoint and endpoint.

In the vector geometry, it would be ... a vector3D.

Yes, I know it is quite easy to construct such from a startPoint and an endpoint... but it is burdensome.

 

And, yes, I understand that The Wrapper has no jurisdiction on the object Under The Wrap.

 

Regards

MichaelT 

 

 

 

MichaelT
0 Likes
Message 6 of 7

john.kirchner
Autodesk
Autodesk

This may be useful for those not super familiar with C++

In C++ there is a class called a Vector that is a dynamically sized array. That is what the 'Vector' is referring to on the BRepEdgeVector object - it is an array of BRepEdge objects.

Even though it shares the same name, it does not have anything to do with a Vector2D or Vector3D object or vectors in the mathematical sense. It is referenced in the 'Python Specific Issues' API documentation here: Fusion Help | Python Specific Issues | Autodesk



Here's a quick generated guide I grabbed from SketchControlPointSplines.controlPoints which returns a SketchPointVector in python

Using a ___Vector class (e.g. SketchPointVector) in Python

controlPoints on a sketch spline returns a SketchPointVector — an array-like object that behaves much like a Python list of SketchPoint objects.

Basics (use these 90% of the time)

  • Get count: len(controlPoints)
  • Access by index: controlPoints[0], controlPoints[-1]
  • Slice: controlPoints[1:3] → returns a Python list
  • Loop: for pt in controlPoints:
  • Check if empty: if not controlPoints: or if controlPoints.empty():
  • Convert to a real Python list: list(controlPoints) (handy for indexing, comprehensions, etc.)

Reading elements

  • controlPoints.front() → first point
  • controlPoints.back() → last point
  • controlPoints.size() → count (same as len(...))

Modifying

  • Add to end: controlPoints.append(pt) or controlPoints.push_back(pt)
  • Set by index: controlPoints[i] = pt
  • Insert / erase: controlPoints.insert(...), controlPoints.erase(...)
  • Remove last: controlPoints.pop_back() (or controlPoints.pop(), which also returns it)
  • Empty it out: controlPoints.clear()

Tips

  • Each element is a SketchPoint — call its normal API methods directly. Use .geometry to get the Point3D position (.x, .y, .z).
  • Prefer the Pythonic style (len, [], for, list(...)) over the array-style methods (size, begin, end, iterators) — both work, but the Pythonic one is cleaner and more readable.
  • Methods like begin(), end(), rbegin(), capacity(), and get_allocator() are rarely needed in Python.

Quick example

spline = sketch.sketchCurves.sketchControlPointSplines.item(0)
controlPoints = spline.controlPoints

print(len(controlPoints)) # how many control points
for pt in controlPoints: # iterate
    p = pt.geometry # Point3D
    print(p.x, p.y, p.z)

first = controlPoints[0] # index into it
pts = list(controlPoints) # convert to a Python list


Message 7 of 7

MichaelT_123
Advisor
Advisor

 

Hi Mr John Kirchner,

 

Thank you for adding your voice...

 

"In C++ there is a class called a Vector that is a dynamically sized array."

 

This is what I meant by "vector geometry" using the efficient data structure like numpy arrays... directly !)

 

Regards

MichaelT

MichaelT
0 Likes