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: 

How to move 3D sketch elements in Z-Direction (move path in Z-direction)

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
1291 Views, 7 Replies

How to move 3D sketch elements in Z-Direction (move path in Z-direction)

Hi, 

 

I want to move a sweeping path in a 3D sketch in Z-direction.

 

My plan: I want to create 2 parallel pipe runs. So, my idea is, to move a path from one sweeping and move it in Z-direction.

 

Any idea how to do that?

 

Greetings

 

Passi

 

 

7 REPLIES 7
Message 2 of 8
Sergio.D.Suárez
in reply to: Anonymous

Hi, Have you tried the 3D Transform tool?


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 8
chandra.shekar.g
in reply to: Anonymous

@Anonymous,

 

Are you trying to move through Inventor API?

 

If so, can you please provide non confidential data to study?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 8
Anonymous
in reply to: chandra.shekar.g

Yes, I wanted to try it via API (was my fault, to forgot it in the previous text).

 

Attached you'll find the example.

 

Left side, a simple line to move and on the right side, the wished result 🙂

 

(The Reply with the 3D transform was exactly what I want, but via API)

 

Greetings

 

Passi

Message 5 of 8

Is it possible?

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
Message 6 of 8

Is it possible through API?

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
Message 7 of 8
WCrihfield
in reply to: liminma8458

Hi @liminma8458.

In the most basic of terms...Yes, it is possible.  But it can get pretty complicated when constraints and dimensions get involved.  I opened the part file that @Anonymous posted, then saved it locally to test with.  Then I created a copy of the original 3D sketch to preserve the original (for comparison), while I attempted to modify the second (copied) sketch (named "3D Sketch2").  Then I measured the distance from start point to start point of the two offset paths, so I know how far to move the geometry with my code, then deleted the two offset paths, leaving just the original path for testing on.  Then, In order to get the following code to work, I had to delete the few constraints that were present in the geometry first, then I ran the rule, and it worked just fine, then I could reapply the constraints to the resulting geometry.  Basically all I did was create a Vector (specifies direction and distance) and used that to move each SketchPoint3D object in the whole sketch by that using that Vector.  Since this example was very simple, just some connected 3D lines (each line has a SketchPoint3D at each end), the code simply moved each point by the specified direction and distance that was specified by the Vector used.

 

If you wanted to go another step further, you could likely catch all constraints within the code, remove them, move all the geometry, then have the code reapply all the same constraings, because they were just aligning a few lines parallel to the origin planes.  But with those constraints still in place, when I move the point at one end of one of those constrained lines, it would move the whole line by that amount, then when it moved the point at the other end of the same line, it would move the whole line an additional amount, causing the geometry to loose its original shape/size.  That's why I first had to eliminate those few constraints before running the rule, then reapply them later.

Here's the iLogic rule that moves (not copies) the whole connected line up in the Z-direction by the specified amount.

Dim oPDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oSketch3D As Sketch3D = oPDef.Sketches3D.Item("3D Sketch2") '<<< CHANGE THIS >>>
Dim oVect As Vector = ThisApplication.TransientGeometry.CreateVector(0,0,128.25 mm)
For Each oSP3D As SketchPoint3D In oSketch3D.SketchPoints3D
	oSP3D.MoveBy(oVect)
Next

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 8 of 8
liminma8458
in reply to: WCrihfield

Yes. It works this way!

 

Thank you so much !

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report