Visual Basic Customization

Reply
Member
wilbert.barten
Posts: 4
Registered: ‎01-08-2003
Message 1 of 6 (251 Views)

Reading blocks from model space

251 Views, 5 Replies
10-01-2013 07:49 AM

Hi,

 

I use a routine to read all blocks from model space. It normally reads all blocks but now we have one issue.

A block is not read when it's placed below Y-coordinate -170.

- this is only on certain computers, on other computers it runs fine.

- this is only when the VBA program is started from paper space, if it's started from modelspace it reads all blocks.

 

Code I use to read all blocks:

 

  Set objAutoCad = ThisDrawing.Application

  Set objModelSpace = objAutoCad.ActiveDocument.ModelSpace()

  For Each objEntity In objModelSpace

    With objEntity

    If StrComp(.EntityName, "AcDbBlockReference", 1) = 0 Then

      If VBA.Left(VBA.UCase(objEntity.Name), 2) = "*U" Then

        MyBlockName = VBA.UCase(objEntity.EffectiveName)

      Else

        MyBlockName = VBA.UCase(objEntity.Name)

      End If

...

 

    End If

    End With

  Next

 

Since the problem is not on all computers I expect this problem is related to some setting in AutoCAD.

 

Any advice is appreciated.

 

Regards,

Wilbert.

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 6 (218 Views)

Re: Reading blocks from model space

10-03-2013 07:08 AM in reply to: wilbert.barten
Just on the quick glance... Change:
"*U"
on
"`*U"
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Member
wilbert.barten
Posts: 4
Registered: ‎01-08-2003
Message 3 of 6 (211 Views)

Re: Reading blocks from model space

10-03-2013 11:43 PM in reply to: wilbert.barten

The extra ' makes no difference.

Mentor
truss_85
Posts: 173
Registered: ‎02-13-2011
Message 4 of 6 (204 Views)

Re: Reading blocks from model space

10-04-2013 12:41 AM in reply to: wilbert.barten

Add to this,

 

objAutoCad.ActiveSpace = acModelSpace

 
What are the differences between two PC s operating system and acad versions.

Member
wilbert.barten
Posts: 4
Registered: ‎01-08-2003
Message 5 of 6 (200 Views)

Re: Reading blocks from model space

10-04-2013 01:22 AM in reply to: truss_85

Hi,

 

objAutoCad.ActiveSpace = acModelSpace gives me Run-tiem error 438 Object doesn't support this propery or method.

I added:   

ThisDrawing.ActiveLayout = ThisDrawing.Layouts("Model")

 

This solved the problem! THANK YOU!

 

Still strange to me it was running correct on 1 computer and not on another.

Both computers have Windows 7 enterprise, Service Pack 1.

Both computers have AutoCAD 2012 - 64 bits installed.

 

Kind regards,

Wilbert.

Mentor
truss_85
Posts: 173
Registered: ‎02-13-2011
Message 6 of 6 (194 Views)

Re: Reading blocks from model space

10-04-2013 03:40 AM in reply to: wilbert.barten

I am glad to help. Since microsoft did not give any support to vba autodesk do it. If there is slightly difference between to machines libraries, it is effectable.

 

Best Regards...

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community