Give one example to trim sketch by vba code

Give one example to trim sketch by vba code

vjyupr4047
Participant Participant
929 Views
9 Replies
Message 1 of 10

Give one example to trim sketch by vba code

vjyupr4047
Participant
Participant

Hello Sir,

I want trim hexagon quater portion by vba.Can you please give one example to trim sketches?

0 Likes
930 Views
9 Replies
Replies (9)
Message 2 of 10

王承之pmhker
Advisor
Advisor

也许您可以在 Inventor 定制论坛中发帖

发明家 iLogic 和 VB.net 论坛 - 欧特克社区


If my post answers your question, please click the "Accept as Solution" button. This helps everyone find answers more quickly!
如果我的回帖解决了您的问题,请点击 "接受为解决方案" 按钮. 这可以帮助其他人更快的找到解决方案!


王 承之
Autodesk AGN [Inventor 俱乐部] Leader
Inventor Club | Bilibili


AGN L    EESignature

0 Likes
Message 3 of 10

vjyupr4047
Participant
Participant

Thank you.

0 Likes
Message 4 of 10

A.Acheson
Mentor
Mentor

Can you give a sample image of what your looking to achieve? Include any sample code you have also. I can only think of creating an extruding feature. Sample here

 

But maybe you want to cut existing sketch before extruding? I am not seeing a trim method under sketch line so I am guessing the point is moved or another sequence of methods happen. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 10

vjyupr4047
Participant
Participant

Hello Alan,

Wish you a happy new year and thank you for your reply.

i attached image below.i want trim except 0- 90 deg sketches

0 Likes
Message 6 of 10

bradeneuropeArthur
Mentor
Mentor
Isn't it already trimmed.
Could you share the ipt file for us.
1 with no trim
2 with the trim you try to do with VBA

Regards,

Arthur

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 10

vjyupr4047
Participant
Participant

Hello Arthur,

Thank you for your reply.

I want to get output as per attached output.ipt by VBA Code.

Kindly give me one example

 

 

Thank you

Vijay

0 Likes
Message 8 of 10

vjyupr4047
Participant
Participant

after this code i am not able to trim

 

 

 

Dim opt As PartDocument
Set opt = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
Dim ocd As PartComponentDefinition
Set ocd = opt.ComponentDefinition
Dim op As PlanarSketch
Set op = ocd.Sketches.Add(ocd.WorkPlanes(3))
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
'Project X-Axis
Dim oxaxis As SketchEntity
Set oxaxis = op.AddByProjectingEntity(ocd.WorkAxes(1))
'Project y-Axis
Dim oyaxis As SketchEntity
Set oyaxis = op.AddByProjectingEntity(ocd.WorkAxes(2))
oxaxis.Construction = True
oyaxis.Construction = True
Dim oc As SketchCircle
Set oc = op.SketchCircles.AddByCenterRadius(oTG.CreatePoint2d(0, 0), 1720 * 0.1 * 0.5)
oc.Construction = True
Dim ox As SketchEntitiesEnumerator
Set ox = op.SketchLines.AddAsPolygon(12, oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(860 * 0.1, 0), False)
Dim cc As DiameterDimConstraint
Set cc = op.DimensionConstraints.AddDiameter(oc, oTG.CreatePoint2d(400 * 0.1, 400 * 0.1))

0 Likes
Message 9 of 10

bradeneuropeArthur
Mentor
Mentor
And what do you like to trim here?
Give me also a screenshot how it needs to be after trim!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 10

vjyupr4047
Participant
Participant

Hello Arthur Knoors,

I want to get vba code as attached image

 

 

 

Thanks,

Vijay k

 

 

 

 

 

 

 

0 Likes