How can I get a Section Plan with multiple Sketch in Section with C# Inventor Api Or VBA?

How can I get a Section Plan with multiple Sketch in Section with C# Inventor Api Or VBA?

nebi_guler
Enthusiast Enthusiast
567 Views
6 Replies
Message 1 of 7

How can I get a Section Plan with multiple Sketch in Section with C# Inventor Api Or VBA?

nebi_guler
Enthusiast
Enthusiast

Ekran Alıntısı.PNG

As seen in the screenshot, the first Sketch created is taken as a reference and the SectionPlan operation is performed on only one Sketch. How can I write to include other Sketches? I know there is a small setting but I couldn't find it.

 

0 Likes
Accepted solutions (1)
568 Views
6 Replies
Replies (6)
Message 3 of 7

nebi_guler
Enthusiast
Enthusiast

Thank you so much @Gabriel_Watson I will check it 

Message 4 of 7

nebi_guler
Enthusiast
Enthusiast

Thank you again . I know these posts. I did look again maybe just in case I'm missing a few things but it doesn't solve my problem. There is a missing setting, I couldn't find it. I'm trying to get a SectionPlan using multiple Sketch.

0 Likes
Message 5 of 7

Michael.Navara
Advisor
Advisor

As described here it is not possible to use multiple sketches for single SectionDrawingView definition. You need to create new sketch and re-draw entities from others to this new one.  DrawingSketch.AddByProjectingEntity Method can't be used for sketch entities.

0 Likes
Message 6 of 7

nebi_guler
Enthusiast
Enthusiast

 

 

DrawingSketch oDrawingSketch;
oDrawingSketch = viewExterior.Sketches.Add();
oDrawingSketch.Edit();
              
Point2d oPoint = _repositoryBase.ReturnTransientGeometry().CreatePoint2d(sp.SectionPlanPoint.X, sp.SectionPlanPoint.Y);

SketchLine oSketchLine = null;
foreach (var item in sp.SectionPlanPoints)
{
Point2d oPointOne = _repositoryBase.ReturnTransientGeometry().CreatePoint2d(item.SectionPlanSketchStartPoint.X, item.SectionPlanSketchStartPoint.Y);
Point2d oPointTwo = _repositoryBase.ReturnTransientGeometry().CreatePoint2d(item.SectionPlanSketchEndPoint.X, item.SectionPlanSketchEndPoint.Y);

if (oSketchLine == null)
{
oSketchLine = oDrawingSketch.SketchLines.AddByTwoPoints(oPointOne, oPointTwo);
 }
else
{
oSketchLine.Parent.SketchLines.AddByTwoPoints(oPointOne, oPointTwo);
}
                          

 

 

 

 

@Michael.Navara The method I use now is

 

0 Likes
Message 7 of 7

nebi_guler
Enthusiast
Enthusiast
Accepted solution
 foreach (var item in sp.SectionPlanPoints)
 {
     Point2d oPointOne = _repositoryBase.ReturnTransientGeometry().CreatePoint2d(item.SectionPlanSketchStartPoint.X, item.SectionPlanSketchStartPoint.Y);
     Point2d oPointTwo = _repositoryBase.ReturnTransientGeometry().CreatePoint2d(item.SectionPlanSketchEndPoint.X, item.SectionPlanSketchEndPoint.Y);

     if (oSketchLine == null)
     {
         oSketchLine = oDrawingSketch.SketchLines.AddByTwoPoints(oPointOne, oPointTwo);
        
     }
     else
     {                               
         SketchLine SketchLineMerge = oDrawingSketch.SketchLines.AddByTwoPoints(oPointOne, oPointTwo);
         oSketchLine.EndSketchPoint.Merge(SketchLineMerge.StartSketchPoint);
         oSketchLine = SketchLineMerge;
     }

 }
0 Likes