Bonjour,
Ce qui a changé :
'----------------------------------------------------------------------------
' Preconditions:
' 1. Open public_documents\tutorial\advdrawings\foodprocessor.slddrw.
' 2. Open an Immediate window.
'
' Postconditions:
' 1. The specified angular running dimension is inserted into the drawing.
' 2. Inspect the Immediate window.
'
' NOTE: Because the model is used elsewhere, do not save changes to it.
' ---------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim PartExt As SldWorks.ModelDocExtension
Dim selmgr As SldWorks.SelectionMgr
Dim dispdim As SldWorks.DisplayDimension
Dim swDispDim As SldWorks.DisplayDimension
Dim vdim As Variant
Dim boolstatus As Boolean
Dim errstatus As Long
Dim i As Long
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set PartExt = Part.Extension
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("", "VERTEX", 0.17648799570697, 0.195948476524618, 4.79999999998881E-03, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.270641278567064, 0.202920893989561, 4.79999999993197E-03, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.238383279638647, 0.257816085148446, -3.99999999899592E-04, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.154059738580153, 0.26234352359454, 6.00000000247292E-04, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.104823845478885, 0.213673560299033, 6.00000000019918E-04, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("", "EDGE", 0.152361949162868, 0.163871737392003, 6.00000000019918E-04, True, 0, Nothing, 0)
vdim = PartExt.AddAngularRunningDim(True, True, True, 0.154288188900673, 7.94194886913027E-02, 0, errstatus)
Part.SetPickMode
For i = 0 To UBound(vdim)
Set dispdim = vdim(i)
Part.Extension.ReJogRunningDimension
Part.Extension.AlignRunningDimension
Debug.Print "Display chained angular dimensions? " & dispdim.DisplayAsChain
Debug.Print "Run the angular dimensions bidirectionally? " & dispdim.RunBidirectionally
Debug.Print "Extend extension lines from center of angular running dimension? " & dispdim.ExtensionLineExtendsFromCenterOfSet
Debug.Print "Are extension lines jogged? " & dispdim.Jogged
Debug.Print "Extension line style same as leader line style? " & dispdim.ExtensionLineSameAsLeaderStyle
Debug.Print "Extension line uses document settings? " & dispdim.ExtensionLineUseDocumentDisplay
Next
End Sub
En gras :
Il y avait un problème de cast en la valeur de retour de la fonction AddAngularRunningDim() et swDispDim.
Aparement, AddAngularRunningDim() renvoie un Array(of DisplayDimension) que vba n'arrivait pas à caster en Object.
En italique, c'est juste une boucle pour afficher les propriétés des côtes créées.
Cordialement.