- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
VBA changes entities property when it should change sketch property as a whole.
Without using VBA there are two ways to modify a drawing sketch's lineweight property.
1) Individually, per entity, from inside the sketch.
2) As a whole, per sketch, from outside the sketch.
VBA should allow a macro to be written to use either method.
You might tell me I'm the one making a mistake here, but I think when VBA modifies a sketch as a whole from outside the sketch it is actually overriding the all entities within the sketch. Which isn't how it works without VBA (ref: screen cap above)
The code that should modify the sketch as a whole looks something like this,,,
Dim oDoc As DrawingDocument
Dim oSketch As DrawingSketch
Set oDoc = ThisApplication.ActiveDocument
Set oSketch = oDoc.ActiveSheet.Sketches(oDoc.ActiveSheet.Sketches.Count)
oSketch.LineWeight = 0.0508
,,,,after the code has run & ended,,, if you edit the sketch to inspect the entities within; it changed them individually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It looks like I got a few views but no replies. ,,,so perhaps the initial post was not clear.
I think I have discovered a bug where VBA should work with a drawing sketch's property, not just the entities in the sketch itself. Using AIP through its GUI you can see how the software is intended to work, and does work.
Using VBA to get AIP to perform the same task, in the correct method, however does not work correctly. The plotted/printed graphics may look the same, but the properties are not set to what should have been done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For me this works fine:
Dim a As Inventor.DrawingDocument = ThisDrawing.Document
Dim sk As Inventor.DrawingSketch = a.ActiveSheet.Sketches.Item(1)
sk.LineWeight= 1
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
and this for the entities based on lines only for my example:
Dim a As Inventor.DrawingDocument = ThisDrawing.Document Dim sk As Inventor.DrawingSketch = a.ActiveSheet.Sketches.Item(1) sk.Edit Dim l As Inventor.SketchLine l = sk.SketchLines.Item(1) l.LineWeight = 6 sk.ExitEdit
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What you have done is illustrate an issue with what is understood to be 'fine'.
The screen capture below illustrates how AIP does work through the GUI,,,
This, below, is what your code outputs,,, incorrectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It looks like Autodesk is ignoring this.
I do not consider this post solved.
So far we have illustrated a misunderstanding about how it is supposed to work.
Has anyone else verified the behavior of the software comparing it to the non-VBA(GUI mehod), and then with the VBA method?