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

And now for my next question:

 

Because there is no exposed method for creating and therefore(?) accessing the WrapToSurface object, I seem to be unable to identify the referenced SketchPoint using the following code:

 

ObjectCollection objCollection = partDoc.AttributeManager.FindObjects("RadialHole", "HolePositionX");
            ObjectCollection sketchPointsColl = RadialHoles.m_InventorApp.TransientObjects.CreateObjectCollection();
            for (int i = 1; i < objCollection.Count + 1; i++)
            {
                if (objCollection[i] is SketchPoint)
                {
                    //may need to cast this to a temporary object to prevent errors?
                    SketchPoint tmpSketchPoint = objCollection[i];
                    sketchPointsColl.Add(tmpSketchPoint);
                }
            }
            partDoc.SelectSet.SelectMultiple(sketchPointsColl);
            partDoc.SelectSet.Select(selectedFace);

            ControlDefinition Sketch3DWrapToSurface = RadialHoles.m_InventorApp.CommandManager.ControlDefinitions["Sketch3DProjectCmd"];
            //.Execute2(true) means we can continue afterwards!
            Sketch3DWrapToSurface.Execute2(true);
            if(new3DSketch.SketchPoints3D.Count > 0)
            {
                foreach (SketchPoint3D item in new3DSketch.SketchPoints3D)
                {
                    /*next line returns null; the item.reference property is true but item.ReferencedEntity = null
                    */
                    SketchPoint referencedSkPoint = (from SketchPoint skp in sketchPointsColl
                                                     where item.ReferencedEntity == skp
                                                     select skp).FirstOrDefault();

Looks like I will need to create transient geometry points in the same way I did before, store their X,Y,Z coordinates and then compare those locations to each wrapped SketchPoint3D to identify the correct location and it's resultant hole information (size, name etc.).

 

Unless there's a method for querying the original SketchPoint objects to see what they are referenced by?

 

Cheers,

 

Alex.