Author Topic: Fast Demolition Code  (Read 8124 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Fast Demolition Code
« on: November 24, 2014, 12:27:48 PM »
I am rewritting our LISP routine that draws our demolition hatching due to several bugs and to fix some workflow issues. I have it most of the way there, but the problem seems to come when selecting more than one open polyline. For some reason when I do, one of the polylines errors out with: ; error: ActiveX Server returned the error: unknown name: "OFFSET"

Here's the code, any assistance that anyone can provide in figuring out what is wrong would be greatly appreciated.

<<Removed Old Code>>
« Last Edit: December 01, 2014, 06:56:54 PM by cmwade77 »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #1 on: November 24, 2014, 12:30:03 PM »
Nevermind, I found it, I was apparently missing a ), code is updated above if it helps anyone and please feel free to let me know if you find any other problems.

Ok, apparently the outline code used from Lee doesn't outline blocks, can anyone help me fix that?
« Last Edit: November 24, 2014, 12:51:16 PM by cmwade77 »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #2 on: November 24, 2014, 04:45:28 PM »
Google is my friend, I found this post here: http://www.theswamp.org/index.php?topic=26664.msg358674#msg358674

I was able to adapt this code into something workable, here is the updated code:
<<Removed Old Code>>

There may still be bugs in it, so I would greatly appreciate any debugging that you may be able to assist with.
« Last Edit: December 01, 2014, 06:56:03 PM by cmwade77 »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #3 on: December 01, 2014, 06:54:48 PM »
Ok, I now have code that should work better, but I would greatly appreciate it if anyone could take a look at it and check for bugs.

<<Removed old code>>


This code will draw demolition hatching over any selected objects, it should work with any AutoCAD object that the boundary command will work on.
« Last Edit: December 02, 2014, 06:47:46 PM by cmwade77 »

77077

  • Guest
Re: Fast Demolition Code
« Reply #4 on: December 02, 2014, 01:31:30 AM »
Ok, I now have code that should work better, but I would greatly appreciate it if anyone could take a look at it and check for bugs.


Hi cmwade77 .
This routine only hatch ? Can you upload a demo( gif) ?

danallen

  • Guest
Re: Fast Demolition Code
« Reply #5 on: December 02, 2014, 01:39:27 AM »
No luck with Bricscad v13, crashes after selecting line.

Code: [Select]
: fd
Select objects to demolish:
Select entities:
Entities in set: 1
Select entities:

; ----- LISP : Call Stack -----
; [0]...C:FD
; [1].....LM:OUTLINE <<--
;
; ----- Error around expression -----
'DISTANCE
;
; error : too few / too many arguments at [EVAL]

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Fast Demolition Code
« Reply #6 on: December 02, 2014, 03:53:02 AM »
Hi Chris,

You may want to use the latest iteration of my LM:outline function, published on my site here - I added some additional error trapping to account for situations in which the bounding box of the set could not be determined.

Lee

danallen

  • Guest
Re: Fast Demolition Code
« Reply #7 on: December 02, 2014, 09:06:13 AM »
that may be it, I selected a vertical line to cause the error

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #8 on: December 02, 2014, 12:13:34 PM »
that may be it, I selected a vertical line to cause the error
Hmm, if it were a PLINE, that should be handled before I ever call Lee's routine, but if it's just a regular line, I don't really handle that anywhere, but I probably should.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #9 on: December 02, 2014, 12:14:12 PM »
Ok, I now have code that should work better, but I would greatly appreciate it if anyone could take a look at it and check for bugs.


Hi cmwade77 .
This routine only hatch ? Can you upload a demo( gif) ?
I honestly am not sure how to create a demo gif, any suggestions for free tools to do so?

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Fast Demolition Code
« Reply #10 on: December 02, 2014, 12:15:37 PM »
Hi Chris,

You may want to use the latest iteration of my LM:outline function, published on my site here - I added some additional error trapping to account for situations in which the bounding box of the set could not be determined.

Lee
Lee, I am starting to wonder if I would ever finish a routine without your help.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Fast Demolition Code
« Reply #11 on: December 02, 2014, 12:30:15 PM »
I honestly am not sure how to create a demo gif, any suggestions for free tools to do so?

www.getsharex.com
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Fast Demolition Code
« Reply #12 on: December 02, 2014, 02:30:20 PM »
As danallen's test shows there is an issue with LM:outline if the 'sel' input only contains elements that do not produce an outline. In that case the return value is an empty selection set, instead of nil as you might expect.

My advice would be:
Change Lee's code so that it returns nil if there is no outline. Whenever you call LM:outline you can then check for a nil return value and act accordingly.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Fast Demolition Code
« Reply #13 on: December 02, 2014, 03:12:07 PM »
The problem that danallen indicated is caused by this line:
Code: [Select]
(setq fh_SS (LM:Outline h_SS))If the user selection contains only a single line, h_SS will be an empty selection set. LM:Outline doesn't work with empty selection sets.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Fast Demolition Code
« Reply #14 on: December 02, 2014, 05:40:11 PM »
Lee, I am starting to wonder if I would ever finish a routine without your help.

I'm delighted to be able to assist you  :-)

My advice would be:
Change Lee's code so that it returns nil if there is no outline. Whenever you call LM:outline you can then check for a nil return value and act accordingly.
...LM:Outline doesn't work with empty selection sets.

Good catch roy -

I agree that the function should be modified to return nil rather than an empty selection set if the outline cannot be generated, however, I don't think the function should be modified to accept a null selection set, as I feel this should be the responsibility of the caller.