Help to translate from VBA to VBscript
tracciatura.net 14 Mar 2019
Hi Everyone,
I'm trying to translate a VBA MAcro to VBscript and I have some problems.
I check every entity in ModelSpace if is a AcDbBlockReference then I check if it has HasAttributes and then and so on but when I want to know the position of this block by
So where I can find all this information?
thnak you
I'm trying to translate a VBA MAcro to VBscript and I have some problems.
I check every entity in ModelSpace if is a AcDbBlockReference then I check if it has HasAttributes and then and so on but when I want to know the position of this block by
ThisDrawing.Utility.Prompt ObjRef.InsertionPoint(0)I have an error
For c = 0 To ThisDrawing.ModelSpace.Count - 1 Set ent = ThisDrawing.ModelSpace.Item(c) ThisDrawing.Utility.Prompt ent.ObjectName If (ent.ObjectName = "AcDbBlockReference") Then Set ObjRef = ThisDrawing.ModelSpace.Item(c) If ObjRef.HasAttributes Then AttList = ObjRef.GetAttributes Valori.JOB = AttList(0).TextString Valori.DWG = AttList(1).TextString Valori.MAT = AttList(5).TextString Valori.QTY = AttList(6).TextString ThisDrawing.Utility.Prompt ObjRef.InsertionPoint(0) End If End If Next
So where I can find all this information?
thnak you
Hellen_V 15 Mar 2019
subzero.tis@tiscali.it, on 14 March 2019 - 10:52 PM, said:
Hi Everyone,
you should better contact Developers' Club with your question: http://developer.nanocad.com
Ivano Rossi 15 Mar 2019
That's incredible for insert a block you can use the exaclty same code from VBA
Dim InsertionPoint(3) InsertionPoint(0) = 0 InsertionPoint(1) = 0 InsertionPoint(2) = 0 Block = "blockname" Xscale = 1.0 Yscale = 1.0 ZScale = 1.0 Rotation = 0.0 ThisDrawing.ModelSpace.InsertBlock InsertionPoint, Block, Xscale, Yscale, ZScale, Rotationbut to know InsertionPoint from an existing block in the drawing InsertionPoint generate an error ...
Ivano Rossi 16 Mar 2019
with this code
I have this response
Obj.ObjectName AcDbBlockReference
IsArray true
ubound 2
so how can I take the value of Obj.InsertionPoint(0) and Obj.InsertionPoint(1) if this generate an error?W TO TAKE A PROPERTY WHERE IS AN ARRAY?how to take a Property value where the Property ia an array?
Set Obj = ThisDrawing.ModelSpace.Item(0) ThisDrawing.Utility.Prompt Obj.ObjectName if (IsArray(Obj.InsertionPoint)) then ThisDrawing.Utility.Prompt "IsArray" ThisDrawing.Utility.Prompt ubound(Obj.InsertionPoint) else ThisDrawing.Utility.Prompt "NOT Array" end if
I have this response
Obj.ObjectName AcDbBlockReference
IsArray true
ubound 2
so how can I take the value of Obj.InsertionPoint(0) and Obj.InsertionPoint(1) if this generate an error?W TO TAKE A PROPERTY WHERE IS AN ARRAY?how to take a Property value where the Property ia an array?
Ivano Rossi 23 Mar 2019
The solution
Dim pnt pnt = ThisDrawing.Utility.CreateSafeArrayFromVector(Obj1.InsertionPoint) ThisDrawing.Utility.Prompt pnt(0) ThisDrawing.Utility.Prompt pnt(1) ThisDrawing.Utility.Prompt pnt(2)