Author Topic: Hatch Boundary help  (Read 4051 times)

0 Members and 1 Guest are viewing this topic.

antistar

  • Guest
Hatch Boundary help
« on: November 01, 2010, 09:08:49 AM »
Hi to all.

I use this routine a lot in my drawings, they still work with CAD2002.
Here's a copy of it I got off Cadalyst.com.
I need help applied parallel to this routine.
How do I send for a "ssget" all the "hatch boundary" created?

Thanks in advance.
Code: [Select]
;Tip1728:   HATCHB.LSP     Recreate hatch boundary  (c)2001, Jimmy Bergmark

http://cadtips.cadalyst.com/boundaries/recreate-hatch-boundary

<edit: Replaced code with a link to original code - CAB>
« Last Edit: November 01, 2010, 04:18:37 PM by antistar »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Hatch Boundary help
« Reply #1 on: November 01, 2010, 12:37:00 PM »
See #7 in the list here POSTING CODE YOU DIDN'T AUTHOR  :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

antistar

  • Guest
Re: Hatch Boundary help
« Reply #2 on: November 01, 2010, 04:21:17 PM »
See #7 in the list here POSTING CODE YOU DIDN'T AUTHOR  :-)

CAB,

I apologize for not having previously read item # 7 of the rules of the forum.
I did not intend to violate the right of the author of the routine.
The link you posted is an updated, with more functions than exists on the page CADALYST.com.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Hatch Boundary help
« Reply #3 on: November 01, 2010, 04:49:33 PM »
« Last Edit: November 01, 2010, 04:53:22 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Hatch Boundary help
« Reply #4 on: November 01, 2010, 05:11:09 PM »
To get new entities load these routines before to do the hatch borders.
Code: [Select]
;;  CAB - get last entity in datatbase
;;  An entity name, or nil, if there are no entities in the current drawing.
(defun GetLastEnt ( / ename result )
  (if (setq result (entlast))
    (while (setq ename (entnext result))
      (setq result ename)
    )
  )
  result
)

;;  CAB 09.17.08 - return a list of new enames
;;  if ename is nil then return all objects in DWG
(defun GetNewEntities (ename / new)
  (cond
    ((or (null ename) (null (setq new (list (entnext))))))
    ((eq 'ENAME (type ename))
      (while (setq ename (entnext ename))
        (if (entget ename) (setq new (cons ename new)))
      )
    )
    ; ((alert "Ename wrong type."))
  )
  new
)

Do the following:
(setq LastEnt (GetLastEnt))
Do you hatch bordering, then this:
(setq NewEnt (GetNewEntities LastEnt))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Hatch Boundary help
« Reply #5 on: November 01, 2010, 05:48:44 PM »
I apologize for not having previously read item # 7 of the rules of the forum.

What's completely laughable is that many of the people who wave that rule about frequently break it themselves in the form of repackage code w/out attribution.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Hatch Boundary help
« Reply #6 on: November 01, 2010, 07:49:06 PM »
Are we talking about these?

Code: [Select]
; Rune Wold and Michael Puckett - modified
; e.g. usage (setq marker (ALE_LASTENT))
;
; Version 1.01 - 20/12/2004
;
; Description:
;   get the absolute last entity in the database,
;   for problems in >=r15 in blocks with attrib, and polylines
;
; Arguments: none
;
; Return Values:
;   An entity name;
;   otherwise nil, if there are no entities in the current drawing
;
; Example: (setq marker (ALE_LASTENT))
;
(defun ALE_LastEnt ( / EntNam OutVal)
  (and
    (setq OutVal (entlast))
    (while (setq EntNam (entnext OutVal))
      (setq OutVal EntNam)
    )
  )
  OutVal
)
;
; Marc'Antonio Alessi - http://xoomer.virgilio.it/alessi
; Function: ALE_Ss-After
;
; Version 1.01 - 20/12/2004
; Version 1.02 - 30/09/2005
;
; Description:
;   get a selection set of items after EntNam in the database
;
; Arguments: An entity name
;
; Return Values:
;   A selection set;
;   otherwise nil, if there are no entities after EntNam
;
; Examples:
;   (setq marker (ALE_LASTENT)) ...create new entities...
;   to include reference entity:
;   (command "_.MOVE" (ALE_SS-AFTER marker) marker "" ...)
;   Note: NOT valid if marker is a SEQEND of
;   blocks with attrib or old polylines (PLINETYPE = 0)
;
;   not include reference entity:
;   (command "_.MOVE" (ALE_SS-AFTER marker) "" ...)
;
(defun ALE_Ss-After (EntNam / SelSet)
  (cond
    ( (not EntNam) (ssget "_X") )
    ( (setq EntNam (entnext EntNam))
      (setq SelSet (ssadd EntNam))
      (while (setq EntNam (entnext EntNam))
        (if (entget EntNam) (ssadd EntNam SelSet))
      )
      SelSet
    )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Hatch Boundary help
« Reply #7 on: November 01, 2010, 07:57:57 PM »
Nope, it's something I've observed for many years. Every one of us should be vigilant to err on the side of generosity w/regards to attribution, especially if we are going to single others out for failing to do so.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

antistar

  • Guest
Re: Hatch Boundary help
« Reply #8 on: November 03, 2010, 09:00:32 AM »
Are we talking about these?

Code: [Select]
; Rune Wold and Michael Puckett - modified
; e.g. usage (setq marker (ALE_LASTENT))
;
; Version 1.01 - 20/12/2004
;
; Description:
;   get the absolute last entity in the database,
;   for problems in >=r15 in blocks with attrib, and polylines
;
; Arguments: none
;
; Return Values:
;   An entity name;
;   otherwise nil, if there are no entities in the current drawing
;
; Example: (setq marker (ALE_LASTENT))
;
(defun ALE_LastEnt ( / EntNam OutVal)
  (and
    (setq OutVal (entlast))
    (while (setq EntNam (entnext OutVal))
      (setq OutVal EntNam)
    )
  )
  OutVal
)
;
; Marc'Antonio Alessi - http://xoomer.virgilio.it/alessi
; Function: ALE_Ss-After
;
; Version 1.01 - 20/12/2004
; Version 1.02 - 30/09/2005
;
; Description:
;   get a selection set of items after EntNam in the database
;
; Arguments: An entity name
;
; Return Values:
;   A selection set;
;   otherwise nil, if there are no entities after EntNam
;
; Examples:
;   (setq marker (ALE_LASTENT)) ...create new entities...
;   to include reference entity:
;   (command "_.MOVE" (ALE_SS-AFTER marker) marker "" ...)
;   Note: NOT valid if marker is a SEQEND of
;   blocks with attrib or old polylines (PLINETYPE = 0)
;
;   not include reference entity:
;   (command "_.MOVE" (ALE_SS-AFTER marker) "" ...)
;
(defun ALE_Ss-After (EntNam / SelSet)
  (cond
    ( (not EntNam) (ssget "_X") )
    ( (setq EntNam (entnext EntNam))
      (setq SelSet (ssadd EntNam))
      (while (setq EntNam (entnext EntNam))
        (if (entget EntNam) (ssadd EntNam SelSet))
      )
      SelSet
    )
  )
)



Thanks CAB for your reply and explanations.
Have a nice day.

Joe Burke

  • Guest
Re: Hatch Boundary help
« Reply #9 on: November 03, 2010, 09:47:58 AM »
Personally I coundn't care less if someone resues my code without "attribution". Sure, it's nice if they mention the source, but I'm certainly not offended if they don't.

I believe the spirit behind this forum is free form sharing. Who wrote what feels like old school thinking to me.

digger

  • Guest
Re: Hatch Boundary help
« Reply #10 on: November 03, 2010, 01:50:10 PM »
Personally I coundn't care less if someone resues my code without "attribution". Sure, it's nice if they mention the source, but I'm certainly not offended if they don't.

I believe the spirit behind this forum is free form sharing. Who wrote what feels like old school thinking to me.

Hi Joe Burke,
I don't have a dog in this hunt and I apologize for what some may consider a hijacking of this thread.
I don't know how to program (yet), but as a poster said elsewhere of Lee Mac's code, it's like looking at art.
Like art, I don't understand much about code, but I appreciate the beauty of it.
I would like to think that if I had snippets of different peoples code and used some of them to make a program that I wouldn't get taken to task for failure to list the source of each and every one.

digger

Joe Burke

  • Guest
Re: Hatch Boundary help
« Reply #11 on: November 04, 2010, 10:58:39 AM »
Example: I use some code by James Allen in my routine named ObjMatrix which is very important to me since various routines use it. I have no idea how James' functions work, but they fix a known potential problem. In this case it would be a sin if I didn't credit James.

On the other hand there's lots of code out there which performs similar tasks in slightly different fashions while accomplishing the same goal. Who determines where the initial idea came from? It's a pointless exercise IMO.