progeCAD support, tips and troubleshooting forum. progeCAD works very similar to some versions of AutoCAD. Moderated.

Moderators: caddit, Moderators

#2286 by Conrad
Thu Nov 12, 2015 5:16 am
I have a simple subroutine, which worked in Cadiopia IntelliCAD 2001, and simply lists Xref's to an MS Excel worksheet. When run for ProgeCAD 2016 I get all the blocks identified as isXref=false. I know they are Xref's, but they all have bad paths, they are also nested.

The original purpose of the routine was to list the Xref's, so I could mess with the path strings in a worksheet, then generate a Script file (*.scr) to correct the paths. I was hoping to modify the subroutine to fix the paths entirely. though not certain if path is a property of the Block definition or insert. Scanning through entities also only identifies Block inserts, it does not find any External References. Rephrase that: it returns the external references (EntityType=16) as block inserts (EntityType=6).

In ProgeCAD the xref's show up as External references in the properties box.

The computer is 64 bit, with 64 bit windows 7. IntelliCAD 2001 is on a different machine so not there to cause interference.

Anyone else experienced similar? Can someone confirm if this is a flaw in ProgeCAD vba objects?

#2287 by caddit
Thu Nov 12, 2015 10:25 am
Hi Conrad,


For VBA discussions we generally ask that you can post the code or something similar, so that one of our technical team can have a look at all aspects which could be producing the results that you describe.


Would it be possible for you to do that please?


Thanks.

#2288 by Conrad
Thu Nov 12, 2015 11:10 am
Thankyou for the reply. The code is :

Sub grabXrefNamesfromDWG(dwgPath As String)
Dim DwgDoc As IntelliCAD.Document
Dim Block As IntelliCAD.Block
Dim en As IntelliCAD.Entity
Dim xrefEntity As IntelliCAD.ExternalReference
Dim blkInsert As IntelliCAD.BlockInsert

'GENERIC OBJECTS
Dim ents As Object 'entities collection
Dim ent As Object 'Single Entity

'SIMPLE VARIABLES
'Dim BlockName As String
Dim count As Long



Dim wrkBk As Workbook
Dim AssemblyWrkSht As Worksheet
Dim AssemblyTable As Range
Dim DwgFileTable As Range
Dim fDrv As String, fpath As String, fname As String, fext As String
Dim i As Integer, j As Integer, r As Integer

Set wrkBk = ActiveWorkbook
Set AssemblyWrkSht = wrkBk.Worksheets("AssemblyList")
Set AssemblyTable = AssemblyWrkSht.Range("A1:A1")

Debug.Print "grabXrefNamesfromDWG ..."

LaunchCADserver
i = 1
r = 1

Call fnsplit2(dwgPath, fDrv, fpath, fname, fext)
'Debug.Print fDrv & fPath & fname & Fext
Set DwgDoc = CADserver.Documents.Open(dwgPath)

'Block Definition Table
For Each Block In DwgDoc.Blocks
'If Block.IsXRef Then
AssemblyTable.Offset(r, 0).Value = fname
AssemblyTable.Offset(r, 1).Value = Block.name
AssemblyTable.Offset(r, 2).Value = Block.IsXRef
'AssemblyTable.Offset(r, 4).Value =
r = r + 1
'End If
Next Block

' Set ents = DwgDoc.ModelSpace
' count = ents.count
' Debug.Print count

' For Each ent In ents
' Debug.Print ent.EntityType, ent.EntityName
'
' Select Case ent.EntityType
' Case 16 'ExternalReference
' Set xrefEntity = ent
' AssemblyTable.Offset(r, 1).Value = xrefEntity.name
' AssemblyTable.Offset(r, 4).Value = xrefEntity.Path
' AssemblyTable.Offset(r, 5).Value = "ExternalReference"
' r = r + 1
' Case 6 'Block Insert
' Set blkInsert = ent
' AssemblyTable.Offset(r, 1).Value = blkInsert.name
' AssemblyTable.Offset(r, 4).Value = blkInsert.EntityType
' AssemblyTable.Offset(r, 5).Value = "Block Insert"
' r = r + 1
'
'' Case 22 'LWPolyline
'' AssemblyTable.Offset(r, 4).Value = "LWPolyline"
'' Case Else
'' AssemblyTable.Offset(r, 4).Value = ent.EntityType
'
' End Select
'
' Next ent



Call DwgDoc.Close(False)

CADserver.Quit

Set CADserver = Nothing

Debug.Print "... grabXrefNamesfromDWG"
Debug.Print "All Done!"

End Sub

Its running from with in MS Excel.

#2289 by caddit
Mon Nov 16, 2015 11:20 am
Dear Conrad,


Thank you very much for providing code to help us determine the source of this software regression.

A fix is already available and the link for the beta version has been sent to your registered email address of your free forum support profile.


Please share with us the results of the fix, if it works for you.


Thank you

#2290 by Conrad
Tue Nov 17, 2015 1:40 am
Thankyou that fixed the first part of the code.

The second part of the code which admittedly is commented out, but was mentioned in original post. When scanning through the entities the external references are returned as block inserts (6) rather than as external references(16).

Also something seems wrong with the object/class definitions. In a DXF file external references are defined in the blocks table, and the block definition has extra tags to identify as Xref and provide the path to the Xref. The same goes when accessing via LISP.

The vba classes have the path property assigned to the External Reference entity, thus implying have to update the path for every instance, rather than once for the definition.

There doesn't seem much point being able to determine a block definition is an Xref, if cannot then access the path to the block definition.

#2295 by Conrad
Thu Nov 19, 2015 6:53 am
Thankyou.

The emailed link returns:

Sorry, the file has been removed,

so unable to check.

#2296 by caddit
Thu Nov 19, 2015 2:10 pm
Hi Conrad,


We were informed that the link has indeed changed again, please check it and revert with results.


Sorry for the confusion (this is obviously why we don't make the links to development versions public :) )


With Regards,

#2297 by Conrad
Fri Nov 20, 2015 4:23 am
Thank you,

That fixed the two main issues. Also noted that Path now a property of the block class, so added the extra line: AssemblyTable.Offset(r, 3).Value = Block.Path. It initially crashed the program, but was ok, once I removed the comments from the isXref test.

Getting path property via the block class, more than I expected. So again thank you.

Recent Topics

User avatar Reloading ProgeCad2016

by caddit

Wed Apr 05, 2017 11:33 pm

Default Avatar Start ProgeCad by C# dll Error

by ftauto

Mon Mar 20, 2017 3:44 pm

User avatar Mathcad Prime 4.0 Released

by caddit

Wed Mar 08, 2017 10:40 pm

User avatar Lisp routine help

by caddit

Wed Mar 08, 2017 10:30 pm

Default Avatar Classic/Ribbon menu help

by SClapham

Sun Feb 19, 2017 11:04 am

Twitter

About Us

Welcome to Ausstralia/New Zealand's CADDIT CAD software forum. CAD CAM Forum for support and discussion regarding AutoCAD, progeCAD IntelliCAD, Geomagic Freeform, Mathcad, CNC software.

This forum offers free support for progeCAD by qualified technical staff. Thank you for visiting.

CADDIT.net

The CADDIT.net team