Results 1 to 10 of 14

Thread: How to connect data in Excel to Block inside Modelspace

Hybrid View

  1. #1
    Member
    Join Date
    2006-03
    Posts
    14

    Question How to connect data in Excel to Block inside Modelspace

    hello. i have a problem here.i have an application where it can find block inside drwg,give the qty and place these report in the drwg.
    purpose :
    create an application to
    a)count block quantity
    b)extract block name and block graphical image
    c)open file(excel) which store the block description ("ID No","height","weight","symbol ","Qty","Block name")
    d)list all the block descriptions inside a table-like.
    can anyone show me how to pform this application?
    is it complicated?if it is,can u suggest anythg else?'

    1) can dbconnect connect the "BLOCK" inside drwg to the"EXTERNAL DATABASE ,like MSAccess/Excel for example?can sum1 show me how?code example,plz?
    2)i have a block type of plant named =" havea brasiliensis" which is stored in a plant file.
    is it possibble for me to extrct the block name with the image for the block altogether ?if possibble,then how?
    but..if it not possible, can sum1 here suggest to me in what way can i get the image represented the block ?because i need to putit inside the table altogether with the "Block Name"

    3)i have tried a code where the first time it executed successfully.But at the second time,it gave me an error .can sumone please tell me how to fix the error?i will attach below.hope to share with all of you out there.im really not an expert in this filed.im a very new beginner in this.really appreciate for any help.

    i really hope sumone out there can help me.please please..i really really need a help.i'm very begginer in this creating application using vb and autocad.please..any help/suggesstion would be great;thanks a lot.
    Attached Files Attached Files
    Last edited by i_len2884; 2006-04-04 at 05:08 PM. Reason: attach file.

  2. #2
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    482

    Default Re: How to connect data in Excel to Block inside Modelspace

    the first time you run the program the selectionset ONLYBLOCKS is not in the drawing the next time you run the program it is so you get a error

    Code:
    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    change the code to
    Code:
    On Error Resume Next
    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    Set objnewss = objDoc.SelectionSets("ONLYBLOCKS")
    On Error GoTo 0
    this way if the selectionset is in the drawing it will just do the next line and set objenewss to the selectionset

    you should add this code before you use the selectionset or any object in the old selectionset will stall be there
    Code:
    objnewss.Clear
    change
    Code:
     
    Dim objnewss As Object '''this line caused an error.why is it?.plz correct it.
    to this
    Code:
     
    Dim objnewss As AcadSelectionSet
    Last edited by jwanstaett; 2006-04-04 at 07:17 PM.
    Note:
    update to 2011
    I am using ADT 2007 08/06/2008

    PS. If you use any Code I post or Down Load Attachment I would like to know if it was helpful. So please post reply to this thread, on how you use the code or down load. Thank You

  3. #3
    Member
    Join Date
    2006-03
    Posts
    14

    Cool Re: How to connect data in Excel to Block inside Modelspace

    So thank you to u...i will try the codes and see what happen.i'll tell you the results tomorrow.Thanks a lot.

  4. #4
    Member
    Join Date
    2006-03
    Posts
    14

    Unhappy Re: How to connect data in Excel to Block inside Modelspace

    i already used it and it succeed but when i close the AutoCAD, i try to run the code again and it wont work...please help
    Last edited by i_len2884; 2006-04-12 at 03:58 AM.

  5. #5
    Member
    Join Date
    2006-03
    Posts
    14

    Unhappy Re: How to connect data in Excel to Block inside Modelspace

    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    On Error Resume Next
    Set objnewss = objDoc.SelectionSets("ONLYBLOCKS")
    Set objnewss.clear
    On Error GoTo 0


    An error accured after "On Error Resume Next" please help

    tq
    Last edited by i_len2884; 2006-04-12 at 04:28 AM.

  6. #6
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,214

    Default Re: How to connect data in Excel to Block inside Modelspace

    Quote Originally Posted by i_len2884
    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    On Error Resume Next
    Set objnewss = objDoc.SelectionSets("ONLYBLOCKS")
    Set objnewss.clear
    On Error GoTo 0


    An error accured after "On Error Resume Next" please help

    tq
    Maybe this will work for you:
    Code:
        Dim objnewss As AcadSelectionSet
        Dim objSelColl As AcadSelectionSets
    
      With ThisDrawing
        Set objSelColl = .SelectionSets
        For Each objnewss In objSelColl
          If objnewss.Name = "ONLYBLOCKS" Then
            objSelColl.Item("ONLYBLOCKS").Delete
            Exit For
          End If
        Next objnewss
        Set objnewss = objSelColl.Add("ONLYBLOCKS")
      End With
    f.
    Last edited by fixo; 2006-04-12 at 08:53 AM.

  7. #7
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    482

    Default Re: How to connect data in Excel to Block inside Modelspace

    Quote Originally Posted by i_len2884
    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    On Error Resume Next
    Set objnewss = objDoc.SelectionSets("ONLYBLOCKS")
    Set objnewss.clear
    On Error GoTo 0


    An error accured after "On Error Resume Next" please help

    tq
    should be
    Code:
     
    On Error Resume Next
    Set objnewss = objDoc.SelectionSets.Add("ONLYBLOCKS")
    Set objnewss = objDoc.SelectionSets("ONLYBLOCKS")
    On Error GoTo 0
    Set objnewss.clear
    Note:
    update to 2011
    I am using ADT 2007 08/06/2008

    PS. If you use any Code I post or Down Load Attachment I would like to know if it was helpful. So please post reply to this thread, on how you use the code or down load. Thank You

Similar Threads

  1. Can't connect data table to excel spreadsheet
    By glenn22 in forum AutoCAD Map 3D - Data Connect (FDO)
    Replies: 7
    Last Post: 2010-05-18, 03:16 PM
  2. Extract Title Block Attribute Data to Excel
    By bzrqmy in forum AutoCAD Customization
    Replies: 6
    Last Post: 2008-12-03, 07:57 AM
  3. Populate Attirbute Block data from Excel
    By avn in forum AutoCAD General
    Replies: 1
    Last Post: 2006-07-07, 04:56 PM
  4. I am unable to connect excel to AutoCAD
    By avinash00002002 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2006-03-16, 11:03 PM
  5. Replies: 2
    Last Post: 2005-07-27, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •