Hi, I am converting from autocad to intellicad and I have a couple of questions
1) In autocad if you create a routine called ACADStartup the coding inside will be run upon loadup. How can i do this on intellicad?
2) I am attempting to read a block on a current drawing and am trying to read in the coordinates that the block is located on the drawing. How can I read in those coordinates in Intellicad (in autocad I used PointX = blockname.insertionpoint)?
3) Same as above, but with rotation.
Thanks
#4
ENSIGN,
The Document Open Event is an event that triggers when any drawing is opened.
This event is not in a specific drawing, it is in the ICAD.Document object and if a new or existing drawing is opened the event and any associated code will run.
Because a new drawing is opened when ICAD starts then the event will trigger.
I have used the event for splash screens with new drawings only i.e. check if the entities count is equal to zero.
------------------
Regards
John Finlay
The Document Open Event is an event that triggers when any drawing is opened.
This event is not in a specific drawing, it is in the ICAD.Document object and if a new or existing drawing is opened the event and any associated code will run.
Because a new drawing is opened when ICAD starts then the event will trigger.
I have used the event for splash screens with new drawings only i.e. check if the entities count is equal to zero.
------------------
Regards
John Finlay
#6
ENSIGN,
In VBAIDE select CommonProjects and IntelliCAD Objects in the project window.
You will see "This Workspace" appear and double click on it to create a code pane.
In the code pane at the top you will see (General) dropdown and (Declarations) dropdown boxes.
Select the (General) dropdown and select Workspace - note the change in the (Declarations) dropdown.
You can now select from a range of events.
Try these out:
Code................................
Private Sub Workspace_New(ByVal NewDocument As IIcadDocument)
MsgBox "Display before Opening a New Drawing in ICAD"
End Sub
Private Sub Workspace_Open(ByVal Document As IIcadDocument)
MsgBox "Display before Opening a Drawing in ICAD"
End Sub
Private Sub Workspace_Startup()
MsgBox "Display before Starting ICAD"
End Sub
End Code..................................
Not hard at all.
------------------
Regards
John Finlay
In VBAIDE select CommonProjects and IntelliCAD Objects in the project window.
You will see "This Workspace" appear and double click on it to create a code pane.
In the code pane at the top you will see (General) dropdown and (Declarations) dropdown boxes.
Select the (General) dropdown and select Workspace - note the change in the (Declarations) dropdown.
You can now select from a range of events.
Try these out:
Code................................
Private Sub Workspace_New(ByVal NewDocument As IIcadDocument)
MsgBox "Display before Opening a New Drawing in ICAD"
End Sub
Private Sub Workspace_Open(ByVal Document As IIcadDocument)
MsgBox "Display before Opening a Drawing in ICAD"
End Sub
Private Sub Workspace_Startup()
MsgBox "Display before Starting ICAD"
End Sub
End Code..................................
Not hard at all.
------------------
Regards
John Finlay
#7
I looked at those routines but unfortunately i am trying to read information from a block on the drawings on loadup and they are all triggered before the drawing is loaded and it generates an error if put in those routines.
Below is the code i am attempting to run. Is it possible to get it to run after the drawing has loaded.
Dim TempBlock As BlockInsert
Dim Loop1 As Integer
Dim Atts As Attributes
Dim VarAttributes As IntelliCAD.Attribute
Dim dxfCode(1) As Integer
Dim dxfValue(1) As Variant
Dim ssBlocks As SelectionSet
dxfCode(0) = 0
dxfValue(0) = "Insert"
dxfCode(1) = 2
dxfValue(1) = "part_tag"
Set ssBlocks = IntelliCAD.ActiveDocument.SelectionSets.Add("Blocks")
ssBlocks.Select vicSelectionSetAll, , , dxfCode, dxfValue
For Loop1 = 1 To ssBlocks.Count
If ssBlocks.Item(Loop1).HasAttributes = True Then
Set Atts = ssBlocks.Item(Loop1).GetAttributes
For Each VarAttributes In Atts
If VarAttributes.TagString = "TEMP_VAR_1" Then
TmpVar1 = VarAttributes.TextString
End If
If VarAttributes.TagString = "TEMP_VAR_2" Then
TmpVar2 = VarAttributes.TextString
End If
If VarAttributes.TagString = "TEMP_VAR_3" Then
TmpVar3 = VarAttributes.TextString
End If
Next
End If
Next
Below is the code i am attempting to run. Is it possible to get it to run after the drawing has loaded.
Dim TempBlock As BlockInsert
Dim Loop1 As Integer
Dim Atts As Attributes
Dim VarAttributes As IntelliCAD.Attribute
Dim dxfCode(1) As Integer
Dim dxfValue(1) As Variant
Dim ssBlocks As SelectionSet
dxfCode(0) = 0
dxfValue(0) = "Insert"
dxfCode(1) = 2
dxfValue(1) = "part_tag"
Set ssBlocks = IntelliCAD.ActiveDocument.SelectionSets.Add("Blocks")
ssBlocks.Select vicSelectionSetAll, , , dxfCode, dxfValue
For Loop1 = 1 To ssBlocks.Count
If ssBlocks.Item(Loop1).HasAttributes = True Then
Set Atts = ssBlocks.Item(Loop1).GetAttributes
For Each VarAttributes In Atts
If VarAttributes.TagString = "TEMP_VAR_1" Then
TmpVar1 = VarAttributes.TextString
End If
If VarAttributes.TagString = "TEMP_VAR_2" Then
TmpVar2 = VarAttributes.TextString
End If
If VarAttributes.TagString = "TEMP_VAR_3" Then
TmpVar3 = VarAttributes.TextString
End If
Next
End If
Next
#8
ENSIGN,
My understanding of this is you want to run your code when IntelliCAD is started and a new drawing is opened. To do this use ICAD.lsp just like ACAD.lsp
1/ Open CommonProjects in the VBAIDE and add a standard module. eg modOpen
2/ Place your code is a public sub. eg Sub BlockCount()
3/ Use Notepad to create ICAD.lsp if you don't already have one.
4/ Add ^C^C^C(command "-vbarun" "modOpen.BlockCount") to the ICAD.lsp
This will run your code after the new drawing has opened.
------------------
Regards
John Finlay
My understanding of this is you want to run your code when IntelliCAD is started and a new drawing is opened. To do this use ICAD.lsp just like ACAD.lsp
1/ Open CommonProjects in the VBAIDE and add a standard module. eg modOpen
2/ Place your code is a public sub. eg Sub BlockCount()
3/ Use Notepad to create ICAD.lsp if you don't already have one.
4/ Add ^C^C^C(command "-vbarun" "modOpen.BlockCount") to the ICAD.lsp
This will run your code after the new drawing has opened.
------------------
Regards
John Finlay