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: 

Automated Custom Detail Drawings

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1011 Views, 3 Replies

Automated Custom Detail Drawings

I am looking to automate the detailing process for my sheet metal inventor projects. There is a very specific way that my job likes parts detailed. When ever I use the default auto dimension settings I get 100 different dimensions that are all mashed together and it is a waste of time. 

 

1. Using ordinate sets that originate from the top left corner for both horizontal and vertical dimensions. 

2. Calling out all punches, holes

3. parts have to be plotted in order of part number (if possible)

4. Bends have to be called out and shown in a formed view. (this means a flat pattern has to be created and then a separate form view has to be created next to it and then aligned with it. Then the bends have to have proper dimensions

 

 

I don't know how difficult this is but this would cut my engineering time in half. Please let me know what kind of ilogic I would need to use. I am new to using Ilogic but I am very interested. Also what programming language does ilogic use? 

 

Please if anyone could point me in the right direction I would appreciate that. 

 

I have attached a screen shot showing how my details look. This is just a page out of 10 others. Since I am only human the trial of error here is very great. The review process for detail drawings spans over a week after the week of laying all these parts out. It can become a long process. Thank you detailing.PNG

 

 

3 REPLIES 3
Message 2 of 4
clutsa
in reply to: Anonymous

This is a VERY broad question. iLogic uses a variant of Visual Basic .NET (or VB.NET) so if you know Visual Basic for Applications (or VBA) what Excel and other Office products use that's a great start. Coding something like what you want is just like a giant jigsaw puzzle. It looks impossible at first but you put it together once piece at a time and the more pieces you get together the faster and easier it goes.

https://forums.autodesk.com/t5/inventor-customization/ilogic-coding-to-create-automated-drawing/td-p...

Above is a link to another very broad question that has more links in the solved section to help you get started. Those are your corner and edge pieces. I suggest you start with those and come back (start an new post) once you have a more specific question about why you can't get some piece of this puzzle to fit. Remember that Google is your friend. I start all my searches with "iLogic" and try to hit keywords about what I'm trying to figure out. Maybe you could try "iLogic Basics" or "iLogic getting started"Smiley Wink

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State
Message 3 of 4
CadUser46
in reply to: Anonymous

This question is HUGE!  Many people, including myself have tried to solve the 'automated drawing' problem.  You can make pieces of the puzzle work but it's still a huge effort with a resulting disjointed process.  I suggest you try to achieve this with just one view and you'll soon see why it's so difficult.  The result is why most people will tend to automate the other parts of the business process such as automated DXF output, batch plotting for work prep etc

 

We actually produce drawings of similar size and in similar fashion, and they certainly dont take a week. At worst a 120 part frame is about 3 days draughting and 1-2 days to check.  And we dont tend to use ordinate dims which would speed things up.

 

Have you tried approaching the problem from a different direction?  Do you have a PDM system?  Are any of the parts shared, can be given their own numbers, drawn once and re-used multiple times?  I know it wouldnt solve the whole problem but it might cutout 10 parts, then there are gains each time it's used.  Standard end plates or box section caps.  The result is work prep needs a set of drawings, not just one but most systems handle this.

Alternatively if you can justify the time saving by sending DXF's you could dump all the flat patterns on one sheet and just have overall dims.

I assume also that you have setup you hole notes so that they automatically produce the correct text first time without any operator override?

 

Also are you aware that with edge selection you can left drag (choosing the area wisely) and place 50-100% of the dims on each axis in one go?  Auto-sort usually helps here as well.  For instance the bottom right view could be done in 2 operations, excluding the hole.


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
Message 4 of 4
AlexFielder
in reply to: CadUser46

The previous posters are absolutely correct, that on the surface this seems like a huge challenge and at first glance it is.

 

BUT it is possible to do this relatively easily if you have the following information:

 

  1. Faces that are known to be datum edges are attributed as such - using the API
  2. Edges that require dimensions are attributed as such, again using the API

The best example of this I have seen (beyond my own work) is that of the Woodwork for Inventor team.

 

Their drawing system is frankly outstanding, but as magic as it may appear to be, if you know the general rules for how the dimensions are applied to arrive at the end goal drawing as per your example, actually getting there isn't that difficult.

 

Yes, there are caveats and pitfalls within the API itself- some of the documentation isn't great, some of the method descriptions within the API frankly could have been better written in crayon.

 

Here is a (partial) drawing view I created entirely using the API:

 

2017-12-21 14_02_23-Autodesk Inventor Professional 2017.png

 

FWIW: I don't need to use Attributes for these hole positions as there is a repeating pattern, but I did use them for the underlying hole features themselves.

 

Once you get your head around adding and retrieving said attributes it's a lot easier.

 

Here are a couple of methods I wrote, one that adds attributes to a collection of 2D sketch points, the other searches a known sketch and retrieves a set of information I had previously stored:

 

*** These were converted from c# to VB.NET using this converter: http://converter.telerik.com/ so apologies if this doesn't work out of the box ***

 

 

Private Shared Sub CreateSketchPointsFromList()
    Try
        Dim percentComplete As Double = 0
        Dim i As Double = 0
        Dim newAttSet As AttributeSet = Nothing
        For Each holeDef As RadialHoleDefinition In radialHoles
            percentComplete = i / radialHoles.Count
            Reporter.UpdateStatusBar(percentComplete, "Creating Sketch Points from Excel Data.")
            Dim transPoint As Point2d = TransGeom.CreatePoint2d(holeDef.XPosition, holeDef.YPosition)
            Dim newPoint As SketchPoint = newSketch.SketchPoints.Add(transPoint, True)
            Dim oAtt As Inventor.Attribute = Nothing
            newAttSet = newPoint.AttributeSets.Add("RadialHole")
            oAtt = newAttSet.Add("HoleDiaParamName", ValueTypeEnum.kStringType, holeDef.HoleDiaParameterName)
            oAtt = newAttSet.Add("HoleSize", ValueTypeEnum.kStringType, holeDef.HoleDia)
            oAtt = newAttSet.Add("HoleDepth", ValueTypeEnum.kStringType, holeDef.HoleDepth)
            oAtt = newAttSet.Add("HoleName", ValueTypeEnum.kStringType, holeDef.HoleDisplayName)
            oAtt = newAttSet.Add("HolePositionX", ValueTypeEnum.kDoubleType, holeDef.XPosition)
            oAtt = newAttSet.Add("HolePositionY", ValueTypeEnum.kDoubleType, holeDef.YPosition)
            Dim newTextPoint As Point2d = TransGeom.CreatePoint2d((holeDef.XPosition / 2), holeDef.YPosition)
            Dim pointConstraint As TwoPointDistanceDimConstraint = newSketch.DimensionConstraints.AddTwoPointDistance(OriginSketchPoint, newPoint, DimensionOrientationEnum.kHorizontalDim, newTextPoint, False)
            pointConstraint.Parameter.Name = "HoleX" & holeDef.HoleDiaParameterName + holeDef.HoleName
            newTextPoint = TransGeom.CreatePoint2d((holeDef.XPosition / 2), (holeDef.YPosition / 2))
            pointConstraint = newSketch.DimensionConstraints.AddTwoPointDistance(OriginSketchPoint, newPoint, DimensionOrientationEnum.kVerticalDim, newTextPoint, False)
            pointConstraint.Parameter.Name = "HoleY" & holeDef.HoleDiaParameterName + holeDef.HoleName
            holeDef.SketchPnt = newPoint
            i += 1
        Next

        newSketch.Edit()
        newSketch.ExitEdit()
    Catch ex As Exception
        log.[Error](ex.Message)
    Finally
        RadialHoles.m_InventorApp.ActiveView.Update()
    End Try
End Sub

Here's the bit that searches a known sketch:

 

private static void CreateGeomForHolePositionComparisons()
        {
            try
            {
                DrawingDebuggingGraphics();

                ObjectCollection objCollection = PartDoc.AttributeManager.FindObjects("RadialHole", "HolePositionX");

                originWP = partCompDef.WorkPoints[1];

                double[] endfaceParams = new double[2];
                double[] endFaceNormals = new double[3];
                endfaceParams[0] = 0;
                endfaceParams[1] = 0;
                selectedEndFace.Evaluator.GetNormal(endfaceParams, endFaceNormals);

                Plane selectedFacePlane = selectedEndFace.Geometry;

                selectedFacePlane.Evaluator.GetNormal(endfaceParams, endFaceNormals);

                selectedWorkPlane.GetPosition(out Inventor.Point tmpWPPoint, out UnitVector tmpXAxis, out UnitVector tmpYAxis);
                double percent = 0;
                double progress = 0;

                for (int i = 1; i < objCollection.Count + 1; i++)
                {
                    if (objCollection[i] is SketchPoint skpoint)
                    {
                        percent = (progress / objCollection.Count);
                        Reporter.UpdateStatusBar(percent, "Creating 3D Points for comparison with Sketch Points.");
                        AttributeSet AttSet = skpoint.AttributeSets[1];
                        Inventor.Attribute xPosAtt = null;
                        double xPosition = 0;
                        Inventor.Attribute yPosAtt = null;
                        double yPosition = 0;

                        xPosAtt = AttSet["HolePositionX"];
                        xPosition = Convert.ToDouble(xPosAtt.Value);
                        yPosAtt = AttSet["HolePositionY"];
                        yPosition = Convert.ToDouble(yPosAtt.Value);

                        Inventor.Attribute holeName = AttSet["HoleName"];
                        string ThisHoleName = holeName.Value.ToString();
                        //creates a basic point for translation.
                        Inventor.Point tmpOriginPoint = TransGeom.CreatePoint(0, yPosition, 0); // datumWorkPoint.Point.Z);
                        Matrix originMatrix = TransGeom.CreateMatrix();
                        Matrix destinationMatrix = TransGeom.CreateMatrix();
                        originMatrix.SetTranslation(originWP.Point.VectorTo(datumWorkPoint.Point));
                        Vector originYVector = TransGeom.CreateVector(0, 1, 0);
                        originMatrix.SetToRotateTo(originYVector, cylinderNormal.AsVector());
                        tmpOriginPoint.TransformBy(originMatrix);
                        tmpOriginPoint.TranslateBy(originWP.Point.VectorTo(datumWorkPoint.Point));
                        //Inventor.Point tmpOriginPoint = TransGeom.CreatePoint(datumWorkPoint.Point.X, yPosition, datumWorkPoint.Point.Z);

                        double radius = selectedFace.Geometry.Radius;
                        double pi = Math.PI;
                        double circumference = ((2 * pi) * radius);
                        double arcLength = xPosition;
                        double arcAngle = (arcLength / ((2 * radius) * pi)) * 360;

                        Arc3d tmpArc = null;
                        tmpArc = TransGeom.CreateArc3d(tmpOriginPoint, cylinderNormal, selectedWorkPlane.Plane.Normal, radius, 0, (arcAngle * (pi / 180)));

                        DrawDebuggingGraphics(tmpArc);

                        RadialHoleDefinition holeDef = (from RadialHoleDefinition hole in radialHoles
                                                        where hole.HoleDisplayName == ThisHoleName
                                                        select hole).FirstOrDefault();
                        if (holeDef?.HoleName.Length > 0)
                        {
                            holeDef.ComparisonPoint = tmpArc.EndPoint;
                        }
                        else
                        {
                            log.Error("One of the HoleDefinitions is incomplete.");
                            Reporter.UpdateStatusBar("One of the HoleDefinitions is incomplete, check the spreadsheet and run again!");
                        }
                        RadialHoles.m_InventorApp.ActiveView.Update();
                        progress++;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }

            //new3DSketch.curves
        }

Hope this helps.

 

Alex.

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report