================================ Check if there is a block copy from other drawings ==========================
'Regarding the setting in AUTOCAD (2020) below, how should I set it in the case of IJCAD (2020 PRO)?
Please let me know.
By the way, when I run this on IJCAD, I get an error in the middle.
'Replacing the ACAD part with GCAD also fails.
How do I write the settings in Dim OBJDBX As New AXDBLib.AxDbDocument'IJCAD?
How do I write the settings in DimobjBlockSAsAXDBLib.AcadBlocks'IJCAD?
How do I write the settings in DimobjBlockA(0)AsAXDBLib.AcadBlock'IJCAD?
How do I write the settings in DimobjBlockAsAXDBLib.AcadBlock'IJCAD?
How do I write the settings in DimblockObjAsAcadBlock'IJCAD?
How do I write the settings in Dim blockRefObjAsAcadBlockReference'IJCAD?
Dim SSYM As String
SSYM = "BLK1" 'Check for blocks you want to invoke
Dim BLKNAM As String: BLKNAM="NON"
' Open Source File
OBJDBX.Open "C:\Users\msys-\Desktop\IJCAD2020 PRO Assessment\LIB1.dwg"
'The line on ERRERR says "Class Not Registered" and an error occurs.
'block collection
SetobjBlockS=OBJDBX.Blocks
'For Y=5 To 300' Repeat if you need more blocks
'Block list to array
For EachobjBlock InobjBlockS
Debug.PrintobjBlock.Name
' If there's a block
IfobjBlock.Name = SSYM Then
BLKNAM = objBlock.Name
SetobjBlockA(0) = objBlock
' Import Blocks
OBJDBX.CopyObjects objBlockA, ThisDrawing.Database.Blocks
End If
Next objBlock
'Next
If BLKNAM="NON" Then
MsgBox SSYM&" is not registered."
Exit Sub
End If
MsgBox BLKNAM
'===================================
vba
You can invoke and place blocks of drawings in a manner similar to the source code described in IJCAD.
'The line on ERRERR says "Class Not Registered" and an error occurs.
IJCAD does not have the ability to manipulate drawings in ObjectDBX, so if you call that function, an error.
IJCAD allows VBA to manipulate drawings without using ObjectDBX.
If so, you will need to rewrite the code you are currently using.
Below is a modified sample that launches IJCAD and registers blocks of other drawings.
SubTest()
DimobjBlockS As GcadBlocks
DimobjBlockA(0) As GcadBlock
DimobjBlock As GcadBlock
US>'Open a new drawing
ThisDrawing.Application.Documents.Add
'Store documentation for new drawings
DimcurDoc As GcadDocument
Set curDoc = ThisDrawing.Application.Documents.Item (ThisDrawing.Application.ActiveDocument.Name)
DimblockObjAsGcadBlock
Dim blockRefObj As GcadBlockReference
Dim SSYM As String
SSYM = "BLK1" 'Check for blocks you want to invoke
Dim BLKNAM As String: BLKNAM="NON"
US>'Open source file
ThisDrawing.Application.Documents.Open "C:\Users\msys-\Desktop\IJCAD2020 PRO Assessment\LIB1.dwg"
' block collection
SetobjBlockS=ThisDrawing.Application.ActiveDocument.Blocks
' Block list to array
For EachobjBlock InobjBlockS
Debug.PrintobjBlock.Name
' If there's a block
IfobjBlock.Name = SSYM Then
BLKNAM = objBlock.Name
SetobjBlockA(0) = objBlock
' Import Blocks
ThisDrawing.Application.ActiveDocument.CopyObjectsobjBlockA, curDoc.Database.Blocks
End If
Next objBlock
'Close the current active drawing
ThisDrawing.Application.ActiveDocument.Close
If BLKNAM = "NON" Then
MsgBox SSYM&" is not registered."
Exit Sub
End If
MsgBox BLKNAM
End Sub
© 2024 OneMinuteCode. All rights reserved.