<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: In-Place Edit fails in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401715#M33285</link>
    <description>&lt;P&gt;Yesss. I was just going to post that is was a proxy issue. Sometimes it helps writing down you issue. Thank you anyways.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Sep 2022 14:06:00 GMT</pubDate>
    <dc:creator>gilsdorf_e</dc:creator>
    <dc:date>2022-09-05T14:06:00Z</dc:date>
    <item>
      <title>In-Place Edit fails</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401706#M33283</link>
      <description>&lt;P&gt;Hi, I'm struggeling to run a code that works well for parts, but fails when running on an in-place edited part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically it fails when trying to add a sketch with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PartComponentDefinition.Sketches.Add(selectedPlanarFace, false)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workflow would be that the user starts in-place edit of a part component. Then the Inventor Addin is started and asks the user to pick a face. Based on that selection, it creates a planar sketch on this face.&lt;/P&gt;&lt;P&gt;When run directly for the part component everything works well.&lt;BR /&gt;When run in-place, I'm getting the ActiveEditDocument. Casting as PartDocument and reading existing sketches from&lt;/P&gt;&lt;P&gt;PartComponentDefinition works well in Debugging. As soon as I try adding a new PlanarSketch with the selected planar face, it will crash with "Wrong parameter".&lt;/P&gt;&lt;P&gt;I suspect that the selected face is somehow in occurence context, so it cannot be used to create a new sketch.&lt;/P&gt;&lt;P&gt;Any ideas, someone?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 13:58:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401706#M33283</guid>
      <dc:creator>gilsdorf_e</dc:creator>
      <dc:date>2022-09-05T13:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: In-Place Edit fails</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401711#M33284</link>
      <description>&lt;P&gt;When you pick the face in assembly context, it is FaceProxy object (not Face object). In this case you can use&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oFace as Face = selectedPlanarFace.NativeObject&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 14:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401711#M33284</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2022-09-05T14:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: In-Place Edit fails</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401715#M33285</link>
      <description>&lt;P&gt;Yesss. I was just going to post that is was a proxy issue. Sometimes it helps writing down you issue. Thank you anyways.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 14:06:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/11401715#M33285</guid>
      <dc:creator>gilsdorf_e</dc:creator>
      <dc:date>2022-09-05T14:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: In-Place Edit fails</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/13028435#M33286</link>
      <description>&lt;P&gt;I am having a similar issue, but I have already resolved the face proxy to a face object.&lt;/P&gt;&lt;P&gt;I am trying to create a sketch centered on a face, so I have identified the center point and can successfully place a work point at that location, but cannot seem to use it as the origin of the sketch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;	Dim oPartDoc As Inventor.PartDocument
	
	If ThisApplication.ActiveDocumentType = kpartDocumentObject Then
			oPartDoc = ThisApplication.ActiveDocument
		Else If ThisApplication.ActiveDocumentType = kAssemblyDocumentObject And ThisApplication.ActiveEditDocument.DocumentType = kpartDocumentObject Then
   			oPartDoc = ThisApplication.ActiveEditDocument
		Else
			i = MessageBox.Show("No part file selected for edit", "No Part for Edit", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
			Exit Sub
  	End If

	Dim oCompDef As Inventor.PartComponentDefinition = oPartDoc.ComponentDefinition

    Dim oTransGeom As Inventor.TransientGeometry = ThisApplication.TransientGeometry
	Dim oPickFace As Inventor.FaceProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Surface to Place Text")
	Dim oSketchAxis As Inventor.Edge
	
	Dim oSketchFace As Inventor.Face = oPickFace.NativeObject
	
	Dim edge1 As Inventor.Edge = oSketchFace.Edges.Item(1)
	Dim edge2 As Inventor.Edge = oSketchFace.Edges.Item(2)
	Dim curve1Eval As CurveEvaluator = edge1.Evaluator
	Dim curve2Eval As CurveEvaluator = edge2.Evaluator
	Dim maxP As Double
	Dim minP As Double
	Dim curveLength1 As Double 
	Dim curveLength2 As Double
	
	Call curve1Eval.GetParamExtents(minP,maxP)
	Call curve1Eval.GetLengthAtParam(minP, maxP, curveLength1)
	Call curve2Eval.GetParamExtents(minP, maxP)
	Call curve2Eval.GetLengthAtParam(minP, maxP, curveLength2)
	
	If curveLength1 &amp;gt; curveLength2 Then
		oSketchAxis = edge1
	Else
		oSketchAxis = edge2
	End If
	
	Dim oEdgeLoop As Inventor.EdgeLoop = oSketchFace.EdgeLoops.Item(1)
	Dim oMinPt As Inventor.Point = oEdgeLoop.RangeBox.MinPoint 
	Dim oMaxPt As Inventor.Point = oEdgeLoop.RangeBox.MaxPoint
	Dim oCtPoint As Inventor.Point = oTransGeom.CreatePoint((oMaxPt.X + oMinPt.X) / 2#, (oMaxPt.Y + oMinPt.Y) / 2#, (oMaxPt.Z + oMinPt.Z) / 2#)
	
	'Fails here at sketch creation
	Dim oSketch As Inventor.PlanarSketch = oCompDef.Sketches.AddWithOrientation(oSketchFace, oSketchAxis, True, True, oCtPoint)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 13:34:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/in-place-edit-fails/m-p/13028435#M33286</guid>
      <dc:creator>cmcgoughHSS</dc:creator>
      <dc:date>2024-09-18T13:34:52Z</dc:date>
    </item>
  </channel>
</rss>

