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: 

Project sketch onto curved surface

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
meck
1746 Views, 2 Replies

Project sketch onto curved surface

I have a 2D skecth that I need to project onto a curved surface using code. Can someone please give me a starting point. I've searched here and the programming help, but I cannot find anything but embossing and decals.

 

Also can someone clue me in as how to search ONLY this forum. I keep setting the search to Board, but it doesn't matter. I'll get results from every Autodesk forum. This is extremely frustrating and time consuming trying to wade through AutoCAD, 3DS max, and general Inventor posts.

 

I'm using Inventor 2013 and iLogic.

 

Thanks.

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
2 REPLIES 2
Message 2 of 3
philippe.leefsma
in reply to: meck

Hi Mike,

 

I doubt this is possible ... Do you mean you would like to project all 2d entities in a sketch onto a surface?

 

In Inventor 2014, a new functionality was added to create intersection curves between entities, so you could extrude the 2d sketch entities as a surface and intersect that with your surface. For previous releases of Inventor, I don't see a way to achieve that.

 

Here is the VBA sample and a pic of the result:

 

' This sample demonstrates several new curve creation techniques
' introduced in Inventor 2014. It creates a new part and then
' create a 2d control point spline and a 2d equation curve. ' Surfaces are created from these two curves by extruding them.
' A 3d intersection curve is created between the extrusions.

Public Sub SketchCurves() ' Create a new part. Dim partDoc As PartDocument Set partDoc = _ ThisApplication.Documents.Add( _ kPartDocumentObject, _ ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject)) Dim partDef As PartComponentDefinition Set partDef = partDoc.ComponentDefinition ' Create a 2D sketch on the X-Y plane. Dim sketch1 As PlanarSketch Set sketch1 = partDef.Sketches.Add(partDef.WorkPlanes.item(3)) Dim tg As TransientGeometry Set tg = ThisApplication.TransientGeometry ' Create a spline based on control points. Dim pnts As ObjectCollection Set pnts = ThisApplication.TransientObjects.CreateObjectCollection Call pnts.Add(tg.CreatePoint2d(2, 0)) Call pnts.Add(tg.CreatePoint2d(4, 1)) Call pnts.Add(tg.CreatePoint2d(4, 2)) Call pnts.Add(tg.CreatePoint2d(6, 3)) Call pnts.Add(tg.CreatePoint2d(8, 1)) Dim controlPointSpline As SketchControlPointSpline Set controlPointSpline = sketch1.SketchControlPointSplines.Add(pnts) ' Create a 2D sketch on the Y-Z plane. Dim sketch2 As PlanarSketch Set sketch2 = partDef.Sketches.Add(partDef.WorkPlanes.item(1)) ' Create a spline based on an equation. Dim equationCurve As SketchEquationCurve Set equationCurve = sketch2.SketchEquationCurves.Add(kParametric, kCartesian, _ ".001*t * cos(t)", ".001*t * sin(t)", 0, 360 * 3) ThisApplication.ActiveView.Fit ' Extrude the 2d curves. Dim prof As profile Set prof = sketch1.Profiles.AddForSurface(controlPointSpline) Dim extrudeDef As ExtrudeDefinition Set extrudeDef = partDef.features.ExtrudeFeatures.CreateExtrudeDefinition(prof, kSurfaceOperation) Call extrudeDef.SetDistanceExtent(6, kSymmetricExtentDirection) Dim extrude1 As ExtrudeFeature Set extrude1 = partDef.features.ExtrudeFeatures.Add(extrudeDef) ' Change the work surface to not be transparent. Dim surf As worksurface Set surf = extrude1.SurfaceBodies.item(1).Parent surf.Translucent = False Set prof = sketch2.Profiles.AddForSurface(equationCurve) Set extrudeDef = partDef.features.ExtrudeFeatures.CreateExtrudeDefinition(prof, kSurfaceOperation) Call extrudeDef.SetDistanceExtent(9, kPositiveExtentDirection) Dim extrude2 As ExtrudeFeature Set extrude2 = partDef.features.ExtrudeFeatures.Add(extrudeDef) ' Create a new sketch and an intersection curve. Dim interSketch As sketch3d Set interSketch = partDef.Sketches3D.Add Call interSketch.IntersectionCurves.Add(extrude1.SurfaceBodies(1), extrude2.SurfaceBodies(1)) End Sub

 

intersec.png

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
meck
in reply to: philippe.leefsma

Thanks Philippe that looks like what I need. I guess I'll have to put the program on hold until next year. My company upgrades every other year. Thanks again!
Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018

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

Post to forums  

Autodesk Design & Make Report