Code: Select all
Base::StringWriter writer;
Part::PropertyGeometryList geoToCopy;
std::vector< Part::Geometry* > newVals;
for (int i = 0; i < listOfGeoId.size(); i++) {
const Part::Geometry* Geo = this->getGeometry(listOfGeoId[i]);
Part::Geometry* geoNew = Geo->copy();
newVals.push_back(geoNew);
}
geoToCopy.setValues(std::move(newVals));
geoToCopy.Save(writer);
Code: Select all
<GeometryList count="3">
<Geometry type="Part::GeomCircle">
<GeoExtensions count="1">
<GeoExtension type="Sketcher::SketchGeometryExtension" internalGeometryType="0" geometryModeFlags="00000000000000000000000000000000" geometryLayer="0"/>
</GeoExtensions>
<Circle CenterX="-94.6912" CenterY="17.6837" CenterZ="0" NormalX="0" NormalY="0" NormalZ="1" AngleXU="-0" Radius="7.55394"/>
</Geometry>
<Geometry type="Part::GeomLineSegment">
<GeoExtensions count="1">
<GeoExtension type="Sketcher::SketchGeometryExtension" internalGeometryType="0" geometryModeFlags="00000000000000000000000000000000" geometryLayer="0"/>
</GeoExtensions>
<LineSegment StartX="-52.3398" StartY="32.4906" StartZ="0" EndX="-97.8044" EndY="-2.98786" EndZ="0"/>
</Geometry>
<Geometry type="Part::GeomCircle">
<GeoExtensions count="1">
<GeoExtension type="Sketcher::SketchGeometryExtension" internalGeometryType="0" geometryModeFlags="00000000000000000000000000000000" geometryLayer="0"/>
</GeoExtensions>
<Circle CenterX="-70.0938" CenterY="18.6362" CenterZ="0" NormalX="0" NormalY="0" NormalZ="1" AngleXU="-0" Radius="17.0619"/>
</Geometry>
</GeometryList>
<ConstraintList count="7">
<Constrain Name="" Type="6" Value="57.6693" First="1" FirstPos="1" Second="1" SecondPos="2" Third="-2000" ThirdPos="0" LabelDistance="8.56602" LabelPosition="-10.5379" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="11" Value="7.55394" First="0" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="8.8168" LabelPosition="0.286939" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="13" Value="0" First="2" FirstPos="3" Second="1" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10" LabelPosition="0" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="5" Value="0" First="2" FirstPos="0" Second="0" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="10" LabelPosition="0" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="7" Value="70.0938" First="2" FirstPos="3" Second="-1" SecondPos="1" Third="-2000" ThirdPos="0" LabelDistance="7.51938" LabelPosition="-15.1256" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="8" Value="18.6362" First="-1" FirstPos="1" Second="2" SecondPos="3" Third="-2000" ThirdPos="0" LabelDistance="-19.9213" LabelPosition="-1.79875" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
<Constrain Name="" Type="11" Value="17.0619" First="2" FirstPos="0" Second="-2000" SecondPos="0" Third="-2000" ThirdPos="0" LabelDistance="9.47208" LabelPosition="-0.0775251" IsDriving="1" IsInVirtualSpace="0" IsActive="1" />
</ConstraintList>
https://github.com/PaddleStroke/FreeCAD/tree/ctrlCctrlV
For information it's build on top of my constrainContextually branch. It doesn't requires it actually so another branch could made from the commits to be PR to upstream as standalone.