Is there a way to open/edit an acad.dvb file in intellicad?
I have been asked to have a look at running a vba add-on for Autocad in Intellicad, and I know nothing about VBA!
SteveN
Re: DVB file
#2Hi Steven,
The DVB is used for AutoCAD, but in IntelliCAD, the VBA file is .vbi. So you cannot directly open the .dvb file in IntelliCAD.
Please load and open the DVB file in AutoCAD visual basic editor, and copy the codes from the editor (paste and save to a text file format).
Then, open the Editor of IntelliCAD and paste the code to it.
Regards,
Quan Nguyen.
The DVB is used for AutoCAD, but in IntelliCAD, the VBA file is .vbi. So you cannot directly open the .dvb file in IntelliCAD.
Please load and open the DVB file in AutoCAD visual basic editor, and copy the codes from the editor (paste and save to a text file format).
Then, open the Editor of IntelliCAD and paste the code to it.
Regards,
Quan Nguyen.
Re: DVB file
#4Hi Quan,
The DVB file in question has a number of FORMS, can these be copied over in the same way?
SteveN
The DVB file in question has a number of FORMS, can these be copied over in the same way?
SteveN
Re: DVB file
#5Hi Steven,
In the visual basic editor of AutoCAD, please export the form to the .frm file.
Then, open the Editor of IntelliCAD and import the .frm file.
Do the same for the module and class.
Regards,
In the visual basic editor of AutoCAD, please export the form to the .frm file.
Then, open the Editor of IntelliCAD and import the .frm file.
Do the same for the module and class.
Regards,
Re: DVB file
#6Thanks Quan,
I will probably have many more questions as I try to port this app across.
SteveN
I will probably have many more questions as I try to port this app across.
SteveN
Re: DVB file
#7I have managed to export/import the Forms & Modules.
However, as expected, ALL of the sub-routines fail.
Here is an example:
This is intended to change the colour of the selected items to colour RED
Error message:
Command: -vbarun
Macro name: DAP.EDIT_MakeRed
Macro failed
Macro failed.
I can see that there is ref to Acad, but I know nothing about VBA to make any changes.
Can anyone offer any pointers please?
SteveN
However, as expected, ALL of the sub-routines fail.
Here is an example:
Code: Select all
Sub EDIT_MakeRed()
Dim t_SSET As AcadSelectionSet
Dim t_Index As Integer
Set t_SSET = ThisDrawing.SelectionSets.Add("TEMP_SSET")
t_SSET.SelectOnScreen
If (t_SSET.Count > 0) Then
For t_Index = 1 To t_SSET.Count
t_SSET.Item(t_Index - 1).Color = acRed
Next t_Index
End If
Call SSetDeleteAll
End Sub
Error message:
Command: -vbarun
Macro name: DAP.EDIT_MakeRed
Macro failed
Macro failed.
I can see that there is ref to Acad, but I know nothing about VBA to make any changes.
Can anyone offer any pointers please?
SteveN
Re: DVB file
#8Hi Steven,
You can refer to the sample code in the official document and then modify the VBA code to fixed with IntelliCAD. BTW, here is the IntelliCAD for changing the selected objects to red color.
You can refer to the sample code in the official document and then modify the VBA code to fixed with IntelliCAD. BTW, here is the IntelliCAD for changing the selected objects to red color.
Code: Select all
Public Sub MakeRed()
Dim ss As SelectionSet
Dim i As Integer
For Each ss In ActiveDocument.SelectionSets
If ss.Name = "TEMP_SSET" Then
ss.Delete
Exit For
End If
Next
Set ss = ActiveDocument.SelectionSets.Add("TEMP_SSET")
ss.SelectOnScreen
If ss.Count <> 0 Then
For i = 0 To ss.Count - 1
ss.Item(i).color.ColorIndex = vicRed
ss.Item(i).Update
Next
End If
End Sub
Re: DVB file
#10Thanks to Quan, I now have 5 working macros:
Change colour to RED, WHITE, YELLOW
Change Linetype to Continuous. Dashed.
Here is the toolbar that I am trying to get working, the icon at the right end manually loads the VBA project. .
I have started on 1 macro 'projectPagesShow' (which is the icon to the right of the yellow icon) and have the form display when selecting the toolbar icon.
SteveN
Change Linetype to Continuous. Dashed.
Here is the toolbar that I am trying to get working, the icon at the right end manually loads the VBA project. .
I have started on 1 macro 'projectPagesShow' (which is the icon to the right of the yellow icon) and have the form display when selecting the toolbar icon.
SteveN
Re: DVB file
#11It's a long time ago but will help, I think.
viewtopic.php?t=894&hilit=vbarun&sid=6b ... 0994950917
viewtopic.php?t=894&hilit=vbarun&sid=6b ... 0994950917
Re: DVB file
#12Hi Quan,
That's basically what I have done on the end of the toolbar.
to load the project:
Then for each macro:
The project loads when selected, and each macro runs fine also when selected.
All I need to do is sort the code for each macro
Yes it was a long time ago!
Tho I have a document on my desktop with links to a number of John's VBA tutorials.
Sadly John hasn't posted in a very long time.
Not sure if his tutorials could be pegged at the top of the index??
SteveN
That's basically what I have done on the end of the toolbar.
to load the project:
Code: Select all
^C^C^CFILEDIA 0 VBILOAD "E:\CustomCad\DAP\SLN.vbi" FILEDIA 1
Code: Select all
^C^C-vbarun SLN.EDIT_MakeRed
All I need to do is sort the code for each macro
Yes it was a long time ago!
Tho I have a document on my desktop with links to a number of John's VBA tutorials.
Sadly John hasn't posted in a very long time.
Not sure if his tutorials could be pegged at the top of the index??
SteveN
Re: DVB file
#13I'm struggling here with the online info and my ability to understand!!
Here is a module from the Acad dvb file:
Does this statement create a new selection set? is it names TEMP SSET ? What is the '2' meaning
Set t_SSET = SSetCreate("TEMP_SSET", 2, "DAPDRB00")
This is what I have so far:
SteveN
Here is a module from the Acad dvb file:
Code: Select all
Sub DAP_ProjectDetailsShow()
Dim t_SSET As AcadSelectionSet
Dim t_Form As Variant
Call SSetDeleteAll 'this is a sub module frequently used, Is it to clear any Selection set details currently retained/memory??
Set t_SSET = SSetCreate("TEMP_SSET", 2, "DAPDRB00")
If (t_SSET.Count = 1) Then
Set t_Form = DAP_DPP 'this is the form to be displayed, which contain fields which match attributes in the drawing border DAPDRB00.DWG
Call DynamicFormLoad(t_Form, t_SSET.Item(0).Handle)
t_Form.show 'show/display the form
End If
Call SSetDeleteAll 'clear any Selection set details ????
End Sub
Does this statement create a new selection set? is it names TEMP SSET ? What is the '2' meaning
Set t_SSET = SSetCreate("TEMP_SSET", 2, "DAPDRB00")
This is what I have so far:
Code: Select all
'BORDER
Sub SLN_ProjectDetailsShow()
Dim t As SelectionSet
Dim t_Form As Variant
' Call SSetDeleteAll
' Set t_SSET = SSetCreate("TEMP_SSET", 2, "DAPDRB00")
' Set ss = SelectionSets.Add("TEMP_SSET", 2, "DAPDRB00")
If (t_SSET.Count = 1) Then
Set t_Form = DAP_DPP
Call DynamicFormLoad(t_Form, t_SSET.Item(0).Handle)
t_Form.show
End If
' Call SSetDeleteAll
End Sub
Re: DVB file
#14Hi Steven,
In VBA, there're distinguish between the Sub and the Function ( in Lisp, they call the Defun too).
The difference between a function and a sub in VBA is that a function can return a value while a sub cannot.
A Sub/Function can have or doesn't have arguments, in your attached, the function SSetCreate has three arguments: the first is a string type, the second one is an integer/real type, and the last one is a string type.
For the meaning of the arguments, the user must refer to the detail of that function.
In VBA, there're distinguish between the Sub and the Function ( in Lisp, they call the Defun too).
The difference between a function and a sub in VBA is that a function can return a value while a sub cannot.
A Sub/Function can have or doesn't have arguments, in your attached, the function SSetCreate has three arguments: the first is a string type, the second one is an integer/real type, and the last one is a string type.
For the meaning of the arguments, the user must refer to the detail of that function.
Code: Select all
Function SSetCreate(ssName As String, numberValue As Double, stringValue As String) As AcadSelectionSet
' do something here
End Function
Re: DVB file
#15Sadly Quan's last answer/reply makes no sense to me .
However I am making some progress, albeit blindly.
So in the function I have:
and in a sub I have:
However when using F8 to increment through the code it stops at:
with acSelectionSetAll highlighted and a Compile error, Variable not defined.
Online searching suggests this is an Autocad Variable name, is there an Intellicad equivalent?
SteveN
However I am making some progress, albeit blindly.
So in the function I have:
Code: Select all
'BORDER
Sub SLN_ProjectDetailsShow()
Dim t_SSET As SelectionSet
Dim t_Form As Variant
Call SSetDeleteAll
Set t_SSET = SSetCreate("TEMP_SSET", 2, "DAPDRB00")
' If (t_SSET.Count = 1) Then
Set t_Form = DAP_DPP
' Call DynamicFormLoad(t_Form, t_SSET.Item(0).Handle)
t_Form.show
' End If
Call SSetDeleteAll
End Sub
Code: Select all
Function SSetCreate(d_SetName As String, d_Mode As Integer, d_Data As String) As SelectionSet
Dim t_SSET As SelectionSet
Dim t_Point1(0 To 2) As Double
Dim t_Point2(0 To 2) As Double
Dim t_Code1(0) As Integer
Dim t_Value1(0) As Variant
Dim t_Code2 As Variant
Dim t_Value2 As Variant
t_Point1(0) = 0: t_Point1(1) = 0: t_Point1(2) = 0
t_Point2(0) = 300: t_Point2(1) = 200: t_Point2(2) = 0
t_Code1(0) = d_Mode
t_Value1(0) = d_Data
t_Code2 = t_Code1
t_Value2 = t_Value1
Set t_SSET = ActiveDocument.SelectionSets.Add(d_SetName)
ActiveDocument.SendCommand ("zoom all" + vbCr)
t_SSET.Select acSelectionSetAll, t_Point1, t_Point2, t_Code2, t_Value2 **********error here
ActiveDocument.SendCommand ("zoom p" + vbCr)
Set SSetCreate = t_SSET
End Function
Code: Select all
t_SSET.Select acSelectionSetAll, t_Point1, t_Point2, t_Code2, t_Value2
Online searching suggests this is an Autocad Variable name, is there an Intellicad equivalent?
SteveN