See the top rated post in this thread. Click here

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

Thread: Error code since version 2022

  1. #1
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Angry Error code since version 2022

    Hi All
    I thought I would post this here because it is related to AutoLisp programming. As many of you may have experienced, AutoCAD 2022 was a little bit buggy from the onset. I found that many of the routines that I used for many many years would not work correctly in AutoCAD 2022 until the last update in March of this year. There is one issue that is still lingering even in 2023. I have an elaborate door program that inserts doors into walls composed of lines that I wrote many many years ago and continued to expand. It works great in all versions prior to 2021. In 2022, when I run the program with the debug feature running for the first time in an existing drawing I get the following error message:
    ; error: Exception occurred: 0xC0000005 (Access Violation)
    ; warning: unwind skipped on unknown exception

    Now here's where it gets weird. First, you should know that all of the door blocks that I use in the program are dynamic blocks which I manipulated with code. If I start a new drawing and use the routine it works fine. If I open an existing drawing that already has one of these dynamic door blocks the routine will insert the door and then it abruptly stops and, if the degugger is off, the following message is displayed at the Command prompt:
    Current settings: Object conversion=Delete
    Enter name of output file:
    Enter name of existing block or
    [= (block=output file)/* (whole drawing)] <define new drawing>:

    The routine is supposed run continuously until you exit it. However, if I run the program a second time it works fine until I insert another door type that already exists in the drawing. It is clear that it has to do with existing dynamic door blocks in the drawing. I suspect that maybe someone on this forum has experienced this problem and has found a solution. Any suggestions and help are greatly appreciated.

    Manuel

  2. #2
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    @ cadconcepts see about

    New System Variables
    LISPSYS - Controls the default AutoLISP development environment started with the VLISP command.

    and refer to

    https://knowledge.autodesk.com/suppo...1E2A6-htm.html

  3. #3
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Hi All
    I was able to reproduce the error that I need help with. I am attaching the code and a block for others to test. Here's the issue: if you run the attached code and insert the dynamic block into a drawing that doesn't have the block in it it works fine. However, if you try the routine in a drawing that has the dynamic block in it will give you an error message after block is inserted and manipulated by code. Here's the error message I get:
    Current settings: Object conversion=Delete
    Enter name of output file:
    Enter name of existing block or
    [= (block=output file)/* (whole drawing)] <define new drawing>:

    I have a great number of dynamic blocks that I manipulate with code that started giving me this error message since version 2022. I have spent many hours on the internet trying to see if anyone else has encountered this problem to no avail. Any help and insights are greatly appreciated. Thanks.
    Manuel

    P.S. You will need to modify the path to the new location of the block on your end.
    Code:
    ;___________________________________________________________________________________________________________
    ;
    ; Function for changing dynamic block properties with wildcards, with error checking and trapping
    ; Predcate function (returns T for success or nil for failure)
    ; Written By: Peter Jamtgaard copyright 2014 all rights reserved
    ; Syntax (dynamicpropertyset nil       "Visibilit*" "none") ; <- nil indicates last entity
    ; Syntax (dynamicpropertyset (entlast) "Visibilit*" "none")
    ; Syntax (dynamicpropertyset objBlock  "Visibilit*" "none")
    ;___________________________________________________________________________________________________________
    (vl-load-com)
    
    (defun CM:DPS (objBlock strWCDynamicProperty Value / objProperty)
     (and
      (or objBlock 
          (setq objBlock (entlast))
      )
      (or (= (type objBlock) 'VLA-OBJECT)
          (and (= (type objBlock) 'ENAME)
               (setq objBlock (vlax-ename->vla-object objBlock))
          )
      )
      (= (type strWCDynamicProperty) 'STR)
      Value
      (wcmatch (vla-get-objectname objBlock) "AcDbBlockReference,AcDbMInsertBlock")
      (= (vla-get-isdynamicblock objBlock) :vlax-true)
      (apply 'or (mapcar '(lambda (objProperty)(and
                                                (wcmatch (strcase (vla-get-propertyname objProperty))
                                                         (strcase strWCDynamicProperty)
                                                )
                                                (errortrap '(vla-put-value objProperty Value))
                                               )
                          )
                          (vlax-invoke objBlock "getdynamicblockproperties")
                 )
      )
     )
    )
    
    ;___________________________________________________________________________________________________________
    ;
    ; Standardized Error Trap
    ;___________________________________________________________________________________________________________
    
    (defun ErrorTrap (symFunction / objError result X)
     (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)
     )
    )
    
    (defun c:idblk (/ inspt )
      (if (setq inspt (getpoint "\nSelect insertion point: "))
        (progn
          (if (tblsearch "BLOCK" "toilet")
            (command "-insert" "toilet1" inspt 1 1 0)
            (command "-insert" (strcat "C:\\CMA 2022\\MEP\\" "toilet1") inspt 1 1 0)
          )
          (CM:DPS (entlast) "Visibility" "Detailed")
        )
      )
    (princ) 
    )
    Attached Files Attached Files

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    I'm not getting this error in Civil 3D 2022 with your code and block. I do not have 2023 installed to test.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Hi Opie
    I tried this in AutoCAD Architecture 2022, AutoCAD 2022 and 2023 and continue to get the error message. I wonder if it was addressed as an update to your version. I have updated my software and I am still getting this message. Did you save the drawing and close the program after inserting the block. I only get this message when I open and try to insert and manipulate a dynamic block that already exists in the drawing. Thanks for testing this out.

    Manuel

  6. #6
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Hi Manuel,

    You don't need all of that check ups along with that error trap, so try the following which is more than enough.

    Code:
    (defun c:Test (/ ins old new ent dyn lst)
      ;;------------------------------------;;
      ;; Author : Tharwat Al Choufi.    ;;
      ;;------------------------------------;;
      (or (tblsearch "BLOCK" "toilet")
          (and (or (findfile "C:\\CMA 2022\\MEP\\toilet")
                   (alert "Search path of 'Toilet' block was not found <!>")
                   )
               (setq old (entlast))
               (or (command "_.-insert" "C:\\CMA 2022\\MEP\\toilet" '(0. 0. 0.)
                            1 1 0
                            )
                   (if (not (= old (setq new (entlast))))
                     (entdel new)
                   )
               )
          )
      )
      (and
        (or (tblsearch "BLOCK" "toilet")
            (alert "Sorry, Toilet block was not found nor has not been imported !")
        )
        (setq ins (getpoint "\nSelect insertion point: "))
        (setq ent (entmakex (list '(0 . "INSERT")
                                  (cons 10 ins)
                                  '(2 . "toilet1")
                                  '(41 . 1.0)
                                  '(42 . 1.0)
                                  '(43 . 1.0)
                                  '(50 . 0.0)
                            )
                  )
        )
        (setq dyn (vlax-invoke
                    (vlax-ename->vla-object ent)
                    'getdynamicblockproperties
                  )
        )
        (vl-some (function
                   (lambda (k) (setq lst (vlax-get k 'allowedvalues)))
                 )
                 dyn
        )
        (member "Detailed" lst)
        (vl-some (function (lambda (u)
                             (and (= (vla-get-propertyname u) "Visibility")
                                  (vla-put-value u "Detailed")
                             )
                           )
                 )
                 dyn
        )
      )
      (princ)
    ) (vl-load-com)

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    I did receive the error mentioned, however, the error did not affect the drawing. I do believe it is a side affect of the dynamic block manipulation routine as the error does not occur until after the insertion of the block.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Hi Tharwat
    I tried your code and it worked. The trick I believe is that you use entmakex to build the inserted block on-the-fly. Now I have another what might be a minor issue. I am saving the block name in a variable but when I try to use entmakex it cannot not evaluate it. I tried to use read and eval and it did not work. Any suggestions? See code below. Thanks.
    Manuel
    Code:
    (setq ent (entmakex (list '(0 . "INSERT")
                                          (cons 10 inspt)
                                          '(2 . (read blknam)) ; (eval blknam) doesn't either 
                                          '(41 . 1.0)
                                          '(42 . 1.0)
                                          '(43 . 1.0)
                                          '(50 . 0.00)
                                 )
                       )
             )

  9. #9
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Just change to
    (cons 2 blknam)

  10. #10
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Re: Error code since version 2022

    Hi All
    So I got the code to work. It inserts the block fine but in the process I have lost all of the dynamic features. The block that I am inserting is a parametric block so I am issuing a value greater than 1.0 for dxf 41 and 42. Does this make a difference? Thanks.
    Manuel
    Code:
    (Setq blkinsang (angle drinspt ptemp))
    
           (if (tblsearch "BLOCK" drtypeval)
             (setq ent (entmake (list '(0 . "INSERT")
                                          (cons 10 drinspt)
                                          (cons 2 drtypeval)
                                          (cons 41 drsize)
                                          (cons 42 drwd2)
                                          '(43 . 1.0)
                                          (cons 50 blkinsang)
                                 )
                       )
             )
    Last edited by cadconcepts; 2022-06-29 at 06:57 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Old code not working in AutoCAD 2022
    By cadconcepts in forum AutoLISP
    Replies: 6
    Last Post: 2021-09-14, 07:45 PM
  2. 2021: 2022 issues
    By rmk in forum AutoCAD Civil 3D - General
    Replies: 2
    Last Post: 2021-06-23, 12:40 PM
  3. What’s new in Revit 2022
    By amit.sondagar795716 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2021-05-18, 01:35 PM
  4. 2021: Fix for missing Fabrication Add-ins for Revit 2022
    By Darren J. Young in forum Revit MEP - General
    Replies: 1
    Last Post: 2021-05-04, 12:56 PM
  5. Replies: 2
    Last Post: 2005-12-28, 04:46 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
  •