Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with Drawing Weld Symbol Creation in Inventor 2024

0 REPLIES 0
Reply
Message 1 of 1
gopinadh7XTGG
249 Views, 0 Replies

Issue with Drawing Weld Symbol Creation in Inventor 2024

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);

}
}
}

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report