See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Summary Info Object Questions

  1. #1
    Member
    Join Date
    2015-01
    Posts
    7
    Login to Give a bone
    0

    Talking Summary Info Object Questions

    First off, my apologies for bumping an old thread. This is the closest thread to giving me what I need. I know nothing about LISP and have been tasked with improving our CAD operator workflow and am in need of some assistance.

    I have a block and there is an attribute which contains a value that I want to use as part of an expression in another mtext field. I started out using the script from Lee Mac and am having trouble understanding it.

    Edit: I'm using AutoCAD 2014

    backstop_pusher_value.jpg
    Last edited by jreno689649; 2015-01-20 at 03:37 PM.

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    What is the name of block you're pointing with text bubble, what is the name of block containing STOP-LOCATION attribute : Left_Stop_Locat??? (red arrow is crossing its name), and please show us a picture where is stored width of the material you're speaking of (defined in a dwgprop)...

  3. #3
    Member
    Join Date
    2015-01
    Posts
    7
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    The box with the text bubble is currently not a block. It is just a text box where the programmer manually enters a calculated value, I'm hoping to make that automatic. The block containing STOP-LOCATION is named Left_Stop_Locator.

    dwgprops.jpg

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Talking Re: Summary Info Object Questions

    Can you post the drawing?

    Peter
    AutomateCAD

  5. #5
    Member
    Join Date
    2015-01
    Posts
    7
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    Here is the dwt and an image. I found out that the block (Left_Stop_Locator) actually grabs it attribute tag from the value of the Left_Stop, circled in the image. If I can get the position of this block, I can then hopefully use it in an expression to push to the "Pusher" value.
    left_stop.jpg
    Attached Files Attached Files

  6. #6
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    1

    Default Re: Summary Info Object Questions

    Let's start with the dwg props (custom info object) to get the multiplier for the material.

    OK I got a little carried away writing this...

    P=



    Code:
    ;___________________________________________________________________________________________________________ 
    ;
    ; CustomInfo Tools Written By; Peter Jamtgaard Copyright 2015
    ;___________________________________________________________________________________________________________ 
    ;
    ; Function List
    
    ; (CustomInfoToList)
    ; (CustomInfo strKey)
    ; (CustomInfoPut strKey strValue)
    ; (CustomInfoAdd strKey strValue)
    ; (CustomInfoRevove strKey)
    ; (Errortrap (quote symFunction))
    
    ;___________________________________________________________________________________________________________ 
    ;
    ; Function to read the summaryinfo information from the summaryinfo object.
    ; Returns a list of sublists 
    ; Each sublist includes summary key, index number and value for each key in a sublist.
    ; Syntax (CustomInfoToList)
    ; Returns (("PROGRAMMER" 0 "MIKE BOCKOVER") ("DRAWING #" 1 "#") ("REVISION" 2 "A") ) ;<- Abbreviated list
    ;___________________________________________________________________________________________________________
    
    (defun CustomInfoToList (/
                             intCustomInfo
                             lstCustomInfoSublists ; List of Custom Information Pairs
                             objSummaryInfo
                             strPValue
                             strPKey
                            )
     (setq objSummaryInfo (SummaryInfoObject))
     (repeat (setq intCustomInfo (vla-NumCustomInfo objSummaryInfo))
      (setq intCustomInfo (1- intCustomInfo))
      (vla-GetCustomByIndex objSummaryInfo intCustomInfo 'strPKey 'strPValue)       
      (setq lstCustomInfoSublists (cons (list strPKey intCustomInfo strPValue) lstCustomInfoSublists))
     )
    )
    
    
    
    ;___________________________________________________________________________________________________________
    
    ; After Notes: 
    ; The SummaryInfo is an object property of the acgivedocumemnt
    ; The NumCustomInfo is a method of the SummaryInfo object that specifies the number of keys
    ; The GetCustomByInfo is also a method of the SummaryInfo object that sets a key and its value.
    ; The CustomInfoSublists is a list of sublists 
    ;___________________________________________________________________________________________________________
    
    ;___________________________________________________________________________________________________________
    ;
    ; Functions to get summary info object
    ; Syntax: (SummaryInfoObject)
    ;___________________________________________________________________________________________________________
    
    (defun SummaryInfoObject ()
     (vla-get-summaryinfo 
      (vla-get-activedocument 
       (vlax-get-acad-object)))
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to get summary info value by key.
    ; Syntax (CustomInfo "PROGRAMMER")
    ;___________________________________________________________________________________________________________
    
    (defun CustomInfo (strKey)
     (if (errortrap (quote (vla-getcustombykey (SummaryInfoObject) (vl-princ-to-string strKey) 'strValue)))
      strValue
     )
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to put summary info value by key.
    ; Syntax (CustomInfoPut "PROGRAMMER" "FRED JONES")
    ;___________________________________________________________________________________________________________
    
    (defun CustomInfoPut (strKey strValue)
     (or
      (errortrap (quote (vla-setcustombykey (SummaryInfoObject) 
                                            (vl-princ-to-string strKey) 
                                            (vl-princ-to-string strValue))))
      (CustomInfoAdd strKey strValue)
     )
    ) 
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to add a new summary info value with key and value
    ; Syntax (CustomInfoAdd "PROGRAMMER" "FRED JONES")
    ;___________________________________________________________________________________________________________
    
    (defun CustomInfoAdd (strKey strValue)
     (errortrap (quote (vla-AddCustomInfo (SummaryInfoObject) 
                                          (vl-princ-to-string strKey) 
                                          (vl-princ-to-string strValue))))
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to add a new summary info value with key and value
    ; Syntax (CustomInfoRemove "PROGRAMMER")
    ;___________________________________________________________________________________________________________
    
    (defun CustomInfoRemove (strKey)
     (errortrap (quote (vla-RemoveCustomByKey (SummaryInfoObject) 
                                              (vl-princ-to-string strKey))))
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Function to Trap LISP Errors
    ;___________________________________________________________________________________________________________
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (X)(set X (eval symFunction)))
                          (list 'result))))
      nil
      (if result result 'T)
     )
    )
    
    
    (vl-load-com)
    ;___________________________________________________________________________________________________________

    ; After Notes:
    ; The SummaryInfo is an object property of the activedocumemnt
    ; The NumCustomInfo is a method of the SummaryInfo object that specifies the number of keys
    ; The GetCustomByInfo is also a method of the SummaryInfo object that sets a key and its value.
    ; The CustomInfoSublists is a list of sublists
    ;___________________________________________________________________________________________________________

    See two new functions in code box

    (CustomInfo "PROGRAMMER") returns the value from the PROGRAMMER custom info
    (CustomInfoPut "PROGRAMMER" "FRED JONES") sets the value of the PROGRAMMER custom info to FRED JONES
    Attached Files Attached Files
    Last edited by peter; 2015-01-25 at 04:47 PM.
    AutomateCAD

  7. #7
    Member
    Join Date
    2015-01
    Posts
    7
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    excellent! I like "baby steps". I see that this portion of code pulls all the DWGPROPs. That is one value that I need to get. I really appreciate the help, I've spent the last few days looking at website after website trying to understand LISP. Would it be possible to add some programming notes so that I understand what is happening? I'd like to be helpful here someday too.

  8. #8
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    See additional notes above.

    Actually I write lisp with long variable names that are self descriptive.

    I find that the code, with the descriptive variable names is almost self explanatory.

    I use the reddick naming convention (with a few tweaks) so you always know what the variable holds obj for object etc...

    The camel naming describes what is in the variable.

    I like longer variable names instead of x or a, and then I have to find where it is defined to understand what it is and what value it holds.

    My preference.


    P=
    Last edited by peter; 2015-01-23 at 11:09 PM.
    AutomateCAD

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    Hi Peter,

    Can you post the two SummaryInfo Overloads mentioned above?

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Summary Info Object Questions

    My Bad,

    They were typo's

    Should be

    CustomInfo
    CustomInfoPut

    They are in the attached file CustomInfoTools.lsp above
    AutomateCAD

Page 1 of 2 12 LastLast

Similar Threads

  1. 2012: Properties dialogue box missing object info
    By depth3d in forum AutoCAD General
    Replies: 3
    Last Post: 2011-08-31, 11:13 AM
  2. unsure start - get object info into attribute
    By rstiles in forum AutoLISP
    Replies: 9
    Last Post: 2011-03-31, 04:45 AM
  3. info. of imported IFC object(s)
    By Ning Zhou in forum Revit - API
    Replies: 0
    Last Post: 2009-08-13, 06:23 PM
  4. Object info does not display in Properties toolbar
    By xwing50 in forum AutoCAD General
    Replies: 7
    Last Post: 2006-04-25, 02:12 PM
  5. Can I push info to an object via a Tag?
    By Nic M. in forum Revit Architecture - General
    Replies: 1
    Last Post: 2006-01-16, 02:30 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
  •