Thank you. This is a simple way to create a polyline curve. However, it is hard to make a polyline curve in the SketchUp application manually. Even if I tried to create a polyline(attached polyline.skp), I can’t get any polyline data by the following API.
For the attached polyline.skp, I can get a curve SUCurveRef by the following API. But I can’t get a SUPolyline3dRef by SUResult res = SUEntitiesGetNumPolyline3ds(entities, &pLinecount). And res is returned SU_ERROR_NONE.
So, perhaps I used the wrong way to create a 3D polyline in the SketchUp application.
@tt_su Clarify your question:
I used SUEntitiesGetNumCurves and SUEntitiesGetCurves to be able to get a SUCurveRef from the attached polyline.skp. polyline.skp is created manually in the SketchUp application. But I can’t get a SUPolyline3dRef from the attached polyline.skp by ‘SUEntitiesGetPolyline3ds’.
So, currently, my question is: I can’t create a model containing a SUPolyline3dRef whether by C API or by the SketchUp application. For C API, I don’t know how save SUPolyline3dRef into a SUModelRef.
Maybe we are talking about different things here… Your polyline.skp doesn’t contain a SketchUp polyline *SUPolyline3dRef - it contains a Curve (SUCurveRef).
A Curve is a set of edges, in the Entities collection. From the UI you can create these with the Freehand tool. The Curve is a meta-entity - simply put it’s just a property on a set of edges that makes SketchUp treat the set of edges as a single unit.
A Polyline3d is a very different entity type - you create it from the UI by holding down Shift while using the Freehand tool. It is its own unique entity which isn’t really used. I think there’s been talks about removing it as we’re not seeing it being used. It creates a line in the model which is not geometry you can snap to or create faces from. It was probably introduced as a way to perform simple annotations.
So lets step back a bit - what is it you are looking to do? Do you really want to be dealing with SUPolyline3dRef - or are you trying to create or read curves? Can you provide some more context to what you are doing?
Btw, with your polyline.skp file I’m able to read the SUCurveRef entities in the model root:
@tt_su Thanks you the detailed explaining. I have created a polyline3d model(attached polyine3d.skp) sucessfully by “create it from the UI by holding down Shift while using the Freehand tool”. This solved my question: I need a model containing polyline3d.
My intent: I am trying to find a model containing a polyline3d, and read polyline3d data by the SketchUp C API. But I don’t know how create such model containing a polyline3d curve. You recommended two ways in this thead: 1. Create a polyline3d by C API ‘SUPolyline3dCreate’ and ‘SUPolyline3dAddPoints’. 2. Create a polyline3d from the UI by holding down Shift while using the Freehand tool.
Till now, Way #2 works for me to create a model containing a polyline3d curve. Way #1 still doesn’t work for me because I don’t know how save SUPolyline3dRef into a SUModelRef . However, Way #2 has solved my issue. So, I think that we can end this thread talking by marking this issue solved. Thank you for your nice support that impresses me deeply.
@tt_su Sorry for the late reply because of my vacation. My work flow is: read a .skp model that contains SUPolyline3dRef into my application now. At the very beginning, I can’t find/create a model containing SUPolyline3dRef. So, I post this issue.