Jump to content

Automation Error No Description provided


broncos15

Recommended Posts

Does anyone happen to know why a lisp routine would work when a small number of objects are grabbed by the user, but it would fail when grabbing a large number of objects and give the following error "Automation Error No Description provided ". I know that the code is breaking at this portion:

(vlax-invoke-method
    fl
    'InsertFeaturePoint
    (vlax-3d-point p)
    piorep
         )

Edited by broncos15
Link to comment
Share on other sites

Broncos15,

 

Could you post all of your code? It makes it tough to see what's going wrong with just a snippet of code.

 

regards,

 

hippe013

Link to comment
Share on other sites

Broncos15,

 

Could you post all of your code? It makes it tough to see what's going wrong with just a snippet of code.

 

regards,

 

hippe013

Hippe, yes I can. It is actually your original code that I edited to allow for multiple selections and for the user to insert either PI's or Elevation Points.

;;;Original routine created by Hippe013 called flint
(vl-load-com)
(defun c:FeatureLineCrossing
      (/ fl site fls p-count sa catch n proc PIorEP cnt)
 (setq olderr *error*)
 (defun *error* (errmes)
   (if (not (= "Function cancelled" errmes))
     (princ
       (strcat
         "\nExecution of FeatureLineCrossing halted by the following error: "
         ERRMES
       )
     )
     (princ)
   )
 )
 (initget "ElevationPoint PI")
 (setq *featurelinecrossings*
 (cond
   (
    (getkword
      (strcat "\nInsert [ElevationPoint/PI] <"
       (setq *featurelinecrossings*
       (cond (*featurelinecrossings*)
      ("PI")
       )
       )
       ">: "
      )
    )
   )
   (*featurelinecrossings*)
 )
 )
 (if (= *featurelinecrossings* "ElevationPoint")
   (setq PIorEP 2)
 )
 (if (= *featurelinecrossings* "PI")
   (setq PIorEP 1)
 )
 (setq p-count 0)
 (while
   (setq ss (ssget '((0 . "AECC_FEATURE_LINE"))))
    (setq cnt 0)
    (repeat (sslength ss)
      (if ss
 (progn
   (setq fl (vlax-ename->vla-object (ssname ss cnt)))
   (setq fl-pnts (vlax-safearray->list
     (vlax-variant-value
       (vlax-invoke-method fl 'GetPoints 3)
     )
   )
   )
   (setq fl-pnts (FL:list->pntlist fl-pnts))
   (setq site (FL:FL->site fl))
   (setq fls (vlax-get-property site 'Featurelines))
;;;    (setq p-count 0)
   (vlax-for f fls
     (if (not (equal f fl))
       (progn
  (setq sa
  (vlax-variant-value
    (vlax-invoke-method fl 'IntersectWith f acExtendNone)
  )
  )
  (setq catch
  (vl-catch-all-apply 'vlax-safearray->list (list sa))
  )
  (if (not (vl-catch-all-error-p catch))
    (progn
      (setq catch (fl:list->pntlist catch))
      (setq n 0)
      (setq
        f-pnts (vlax-safearray->list
   (vlax-variant-value
     (vlax-invoke-method f 'GetPoints 3)
   )
        )
      )
      (setq f-pnts (FL:list->pntlist f-pnts))
      (repeat (length catch)
        (setq p (nth n catch))
        (if (not (member p proc))
   (progn
     (if (not (member p fl-pnts))
       (progn
         (vlax-invoke-method
    fl
    'InsertFeaturePoint
    (vlax-3d-point p)
    PIorEP
         )
         (fl:drx p PIorEP)
         (setq proc (append proc (list p)))
         (setq p-count (+ p-count 1))
       )
     )
     (if (not (member p f-pnts))
       (progn
         (vlax-invoke-method
    f
    'InsertFeaturePoint
    (vlax-3d-point p)
    PIorEP
         )
         (fl:drx p PIorEP)
         (setq proc (append proc (list p)))
         (setq p-count (+ p-count 1))
       )
     )
   )
        )
        (setq n (+ n 1))
      )
    )
    (progn)
  )
       )
     )
   )
;;;    (princ
;;;      (strcat "\nInserted "
;;;       (itoa p-count)
;;;       *featurelinecrossings*
;;;      )
;;;    )
 )
 (princ "\nNothing was Selected.")
      )
      (setq cnt (+ cnt 1))
    )
 )
 (if (> p-count 0)
   (if (>= p-count 2)
     (princ
       (strcat "\nInserted "
               (itoa p-count)
               " "
               *featurelinecrossings*
               "'s"
       )
     )
     (princ
       (strcat "\nInserted "
               (itoa p-count)
               " "
               *featurelinecrossings*
       )
     )
   )
 )
 (setq *error* OLDERR)
 (princ)
)

(defun FL:Site->FL-ID-List (site / fls cnt ret n li)
 (setq fls (vlax-get-property site 'Featurelines))
 (setq cnt (vlax-get-property fls 'Count))
 (if (= cnt 0)
   (setq ret nil)
   (progn
     (setq n 0)
     (repeat cnt
(setq
  li (append
       li
       (list (vlax-get-property (vla-item fls n) 'ObjectID))
     )
)
(setq n (1+ n))
     )
     (setq ret li)
   )
 )
 ret
)
(defun FL:List->pntlist (li / newli n)
 (setq n 0)
 (repeat (/ (length li) 3)
   (setq newli (append newli
  (list (list (nth n li)
       (nth (+ n 1) li)
       (nth (+ n 2) li)
        )
  )
 )
   )
   (setq n (+ n 3))
 )
 newli
)
(defun FL:FL->Site (fl / cvlapp cvlad sites ret n site objid-list)
 (setq cvlapp (vlax-get-property fl 'application))
 (setq cvlad (vlax-get-property cvlapp 'ActiveDocument))
 (setq sites (vlax-get-property cvlad 'Sites))
 (setq ret nil)
 (setq n 0)
 (repeat (vlax-get-property sites 'Count)
   (setq site (vla-item sites n))
   (setq objid-list (FL:Site->FL-ID-List site))
   (if (member (vlax-get-property fl 'ObjectID) objid-list)
     (setq ret site)
   )
   (setq n (1+ n))
 )
 ret
)

(defun FL:drx (ctr clr / cor1 cor2 cor3 cor4 vs xs)
 (setq vs (getvar "viewsize"))
 (setq xs (/ vs 40))
 (setq cor1 (polar ctr (* pi 0.25) xs))
 (setq cor2 (polar ctr (* pi 0.75) xs))
 (setq cor3 (polar ctr (* pi 1.25) xs))
 (setq cor4 (polar ctr (* pi 1.75) xs))
 (grdraw ctr cor1 clr 0)
 (grdraw ctr cor2 clr 0)
 (grdraw ctr cor3 clr 0)
 (grdraw ctr cor4 clr 0)
)
;|«Visual LISP© Format Options»
(100 2 40 2 nil "end of " 100 9 0 0 0 nil T T T)
;*** DO NOT add text below the comment! ***|;

Edited by broncos15
Link to comment
Share on other sites

Try to use construction like

(setq res (vl-catch-all-apply
           (function
             (lambda ()
                     ;; here is your code
              ) ;_ end of lambda
             ) ;_ end of function
           ) ;_ end of vl-catch-all-apply
     ) ;_ end of setq

if type of res is not you expexted or (vl-catch-all-error-p res) returns t - than you get the error.

 

P.S. I can't check your code - I have no dwgs with AECC_FEATURE_LINE objects.

Link to comment
Share on other sites

Broncos15,

 

I have tested your edited code. I can't get it to fail. I can't see how this would fail depending on a number of objects. Post sample dwg?

 

regards,

 

hippe013

Link to comment
Share on other sites

Hippe013, what's strange is that I can't always get it to fail either, which is why I am having such a difficult time debugging it. I tried doing it on a site I was grading and I noticed that it wouldn't work when I grabbed all the feature lines. See my post below for a quick sketch in which it won't work if I grab all of the feature lines.

Link to comment
Share on other sites

So I have continued to try and debug it and I can't find any solutions. What I have found works, is the above drawing, if I explode the feature lines into a 3d polylines, then turn them back into feature lines, the code works perfectly. It makes no sense why this works. I should also add that your original code Hippe013 works on each of the feature lines without having to explode them.

Link to comment
Share on other sites

Sorry to post again, but I have spent a lot of time trying to debug it and I still can't figure out why the code works if only one selection is allowed, but if multiple selections are allowed then it only sometimes fails. Is there something I am missing when I wrote the while loop?

Link to comment
Share on other sites

Broncos15,

 

Sorry, I haven't had any time to take a look at your code to test this out. I will try and look at it this weekend if time allows.

 

regards,

 

hippe013

Link to comment
Share on other sites

Broncos15,

 

Sorry, I haven't had any time to take a look at your code to test this out. I will try and look at it this weekend if time allows.

 

regards,

 

hippe013

Hippe013, no worries. Thank you so much for taking time to look at it and help!
Link to comment
Share on other sites

The problem appears to be with the member function. If there is a small difference in the points the member function doesn't detect that it is a part of the list. To correct this I wrote a small subroutine.

 

(defun FL:ismember ( p pnts / ismember)
 (foreach x pnts
   (if (equal p x 0.000000001)
     (setq ismember T)
     )
   )
 ismember
 )

 

Anywhere you have member in your code replace it with FL:ismember. This seemed to have fixed the bug.

Link to comment
Share on other sites

I haven't read the whole thread, but 'FL:ismember' could also be written:

(defun FL:ismember ( p pnts ) (vl-some '(lambda ( x ) (equal p x 1e-8)) pnts))
 
Edited by Lee Mac
Link to comment
Share on other sites

Hippe013, thank you so much for looking at this and helping me with it! Lee, thank you for your code as well, it works perfectly like Hippe's, although I am having a harder time following exactly what it is doing compared to his code. My question, is how large a correction value can be used (when testing it on a few drawings I had to increase the value up to 1e-1 to get it to work on all feature lines) before it is no longer accurate?

Edited by broncos15
Link to comment
Share on other sites

Thanks Lee.

 

I haven't used vl-some before. I like how it stops evaluation upon a non-nil value.

 

You're welcome! :)

 

My question, is how large a correction value can be used (when testing it on a few drawings I had to increase the value up to 1e-1 to get it to work on all feature lines) before it is no longer accurate?

 

The current code will classify the given point 'p' as being a member of the point list 'pnts' if at least one point in 'pnts' is within a radius of 1e-8 (0.00000001) of the given point 'p'. Therefore, this tolerance should be adjusted to suit the maximum distance between points in your drawing that you consider to be the 'same point'.

Link to comment
Share on other sites

You're welcome! :)

 

 

 

The current code will classify the given point 'p' as being a member of the point list 'pnts' if at least one point in 'pnts' is within a radius of 1e-8 (0.00000001) of the given point 'p'. Therefore, this tolerance should be adjusted to suit the maximum distance between points in your drawing that you consider to be the 'same point'.

Lee, thank you for the information! I ended up having to increase the tolerance because a few drawings required it, but with your information I was able to know what the maximum value I felt comfortable with was. I still think it is weird that the member function only has issues when multiple selections are allowed, but the single selection code works fine, but oh well, whatever works I guess haha. Thanks again! Edited by broncos15
Link to comment
Share on other sites

  • 5 years later...

Getting this error again intermittently on some drawings - any thoughts on what could be causing it? 

  • Attached:
    • Current lisp routine we've been using since 2015 with the Lee Mac/broncos15 mods
    • Drawing showing the error - reduced down to just an exact section with the issue
    • Image from Visual Lisp editor showing the last settings/variables before the error takes place

 

  • Troubleshooting attempts:
    • Increased the tolerance to 1.5 (was 0.09) - that did not work
    • Tried reversing one feature line, then just the other feature line, then both - all to no avail

828867313_Annotation2020-11-17150128.thumb.jpg.98d8d96447ecdfc401ab6fefcdb72f81.jpg

FeatureLineCrossing.lsp FeatureLineCrossing Error.dwg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...