Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
tom.prichard
321 Views, 5 Replies

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.

EntityProperty.jpg

2) As a whole, per sketch, from outside the sketch.

SketchProperty.jpg

 

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.