Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dimension in 2d drawing

Status
Not open for further replies.

si_mon

Aerospace
Mar 8, 2023
2
0
0
NL
Hi all,
I'm trying to create a simple dimension in the drawing module in VBScript.
The following code works fine in CATScript but when I try to use it VBScript I get an error.
Any idea what is wrong with this code?


Code:
Dim Draw_point_1
Set Draw_point_1 = fact_Draw.CreatePoint(Blank_size_x_max.Value + 50, 0)

Dim Draw_point_2
Set Draw_point_2 = fact_Draw.CreatePoint(-Blank_size_x_min.Value - 50, 0)

Dim Line1
Set Line1 = fact_Draw.CreateLine(0, 0, 1, 0)
 
Dim iType As CatDimType
iType = catDimDistance
 
ReDim myElements(1)
myElements(1) = Array(Draw_point_1, Draw_point_2)

ReDim selpoints(3)
selpoints(3) = Array(0, 0, 0, 0)

Dim MyDimension
[highlight #CC0000]Set MyDimension = oFrontView11.Dimensions.Add2(iType, myElements(1), selpoints(3), Line1, 0)[/highlight]

Set oDimVal = MyDimension.GetValue
oDimVal.SetFormatPrecision 1, "1"

here is the error
compile error:
function or interface marked as restricted, or the function uses an automation type not supported in VB
 
Replies continue below

Recommended for you

I already know what was wrong [smile]

for CATScript it can be:
Code:
    ' Create a view called "Front View" in this sheet
    Dim oFrontView11 As DrawingView
    Set oFrontView11 = oSheet.Views.Add("Front View")

but for VBScript
Code:
' Create a view called "Front View" in this sheet
    Dim oFrontView11
    Set oFrontView11 = oSheet.Views.Add("Front View")
 
Status
Not open for further replies.
Back
Top