Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Issue with Drawing Weld Symbol Creation in Inventor 2024

gopinadh7XTGG
Explorer

Issue with Drawing Weld Symbol Creation in Inventor 2024

gopinadh7XTGG
Explorer
Explorer

Hello All,

 

I was trying to create a Drawing weld symbol of Surfacing weld symbol type in Inventor 2024. I was getting this error (The remote procedure call failed. (Exception from HRESULT: 0x800706BE)) and Inventor is terminated only for the Surfacing weld symbol type Enum (WeldSymbolTypeEnum.kSurfacingOrCladdingWeldSymbolType). All other types are working fine. Below is the code I am using and attached are the cad files I am using for testing purpose.
https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=WeldSymbolTypeEnum

Any help is appreciated.

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Inventor;
using System.Runtime.InteropServices;

namespace Testcase_Inv2024_WeldSymbol_Creation
{
static class Program
{
static void Main()
{
Inventor.Application oApp = Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;

DrawingDocument drawingDocument = oApp.ActiveDocument as DrawingDocument;

Sheet oActiveSheet = drawingDocument.ActiveSheet;

// Set a reference to the drawing curve segment.
// Please select a linear drawing curve.
DrawingCurveSegment oDrawingCurveSegment =
oApp.CommandManager.Pick(
SelectionFilterEnum.kDrawingCurveSegmentFilter,
"Select a linear curve") as DrawingCurveSegment;

// Set a reference to the drawing curve.
DrawingCurve oDrawingCurve = oDrawingCurveSegment.Parent;

// Get the mid-point of the selected curve
// assuming that the selection curve is linear.
Point2d oMidPoint = oDrawingCurve.MidPoint;

// Set a reference to the TransientGeometry object.
TransientGeometry oTG = oApp.TransientGeometry;

// Create an ObjectCollection for leader points.
ObjectCollection oLeaderPoints = oApp.TransientObjects.CreateObjectCollection();

// Create a few leader points.
oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 1, oMidPoint.Y + 1));

// Create an intent and add it to the leader points collection.
// This is the geometry that the symbol will attach to.
GeometryIntent oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve, oMidPoint);

//oLeaderPoints.Add(oMidPoint);

oLeaderPoints.Add(oGeometryIntent);

// Set a reference to the DrawingWeldingSymbolDefinitions.
DrawingWeldingSymbolDefinitions oWeldingSymDefs = oActiveSheet.WeldingSymbols.CreateDefinitions();

// Add a welding symbol definition.
DrawingWeldingSymbolDefinition oWeldingSymDef = oWeldingSymDefs.Add(1);

// Specify the weld symbol type (WeldSymbolTypeEnum/BackingSymbolTypeEnum).
//oWeldingSymDef.WeldSymbolOne.WeldSymbolType = (int)WeldSymbolTypeEnum.kFilletWeldSymbolType;
oWeldingSymDef.WeldSymbolOne.WeldSymbolType = (int)WeldSymbolTypeEnum.kSurfacingOrCladdingWeldSymbolType;

oWeldingSymDef.WeldSymbolTwo.WeldSymbolType = (int)WeldSymbolTypeEnum.kNoneWeldSymbolType;
oWeldingSymDef.ClosedNoteTail = true;
oWeldingSymDef.TailNote = "2X";
oWeldingSymDef.AllAroundSymbol = true;
oWeldingSymDef.FieldWeldingSymbol = true;

// Create the symbol with a leader.
DrawingWeldingSymbol oSymbol = oActiveSheet.WeldingSymbols.Add(oLeaderPoints, oWeldingSymDefs);

}
}
}

Reply
281 Views
0 Replies
Replies (0)