Author Topic: Arc Trim ??  (Read 4932 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Arc Trim ??
« on: November 19, 2003, 05:19:27 PM »
Maybe someone has an easy solution.

This routine has the user draw an arc and then places a 4" circle at
the first point picked. My problem is in trimming the arc that is
within the circle. If i use ptPick instead of ArcEnt sometimes the
arc was started on top of another entity and it ia trimmed instead.
But using ArcEnt has it's own problems. If the Arc is drawn in a
particular direction the part outside of the circle is trimmed.

Any easy fix for this? :oops:


CAB


Code: [Select]
;;;   By Charles Alan Butler  : Last Modified 11/19/03
;;;   ArcC.lsp    (Arc Leader with Circle Arrow Head)
;;;   Uses the current layer & Circle Arrow head

;; error function & Routine Exit
(defun *error* (msg)
  (if
    (not
      (member
msg
'("console break" "Function cancelled" "quit / exit abort")
      )
    )
     (princ (strcat "\nError: " msg))
  ) ; if
  (princ)
) ;
;end error function

;;;======  Main Lisp Routine  =======
(defun c:ArcC (/ usercmd   useros    pt1       pt2
      pttemp ptpick   L_Angle   cenpt     rad
      StartAng arcdata   EndAng    
     )
  (princ "\n")
  (princ "\n       Arc Leader w/ Circle Arrow - Version 1.0")
  (princ "\n")

;;; -------  Some Housekeeping   ------------------
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "osmode" 0)
  (setq userANGDIR (getvar "angdir"))
  (setvar "angdir" 0)

  (setq ptpick (getpoint "\nPick leader start point: "))
  (command "arc" ptpick pause pause)
  (if (= "ARC" (cdr (assoc 0 (entget (entlast)))))
    (progn
      (setq ArcEnt (entlast))
      (setq arcdata  (entget ArcEnt)
   cenpt    (cdr (assoc 10 arcdata))
   rad     (cdr (assoc 40 arcdata))
   StartAng (cdr (assoc 50 arcdata))
   EndAng   (cdr (assoc 51 arcdata))
      )
      (Command "_.Circle" ptpick 2) ; circle arrow head 2" radius
      (ssget "l") ; use circle as cutting edge
      (command "trim" "p" "" ArcEnt "") ; trim arc only

;;;==========  Exit Sequence  ============
      (setvar "osmode" useros)
      (setvar "CMDECHO" usercmd)
      (setvar "angdir" userangdir)
      (princ)
    ) ; end progn
  ) ; endif ARC
) ;  end defun
(prompt "\nType  ArcC  to run")
(princ)

;;;==========  End of Routine  ============
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.

DParcon

  • Guest
Arc Trim ??
« Reply #1 on: November 19, 2003, 07:42:41 PM »
Set your osnap to none (setvar "osmode" 0)

 Save the arc entity name preserving the endpoint
 inside the circle. (setq ArcEnt (list (entlast) ptpick))

 Trim the end of the arc after circle command:
   (command "_trim" (entlast) "" ArcEnt "")

 Try these changes and your routine will work
 flawlessly (hopefully...)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Arc Trim ??
« Reply #2 on: November 19, 2003, 08:02:03 PM »
THANKS, it worked, but why? :(


How does this line work?
 (command "_trim" (entlast) "" ArcEnt "")
I know the (entlast) picks the circle but  how does
ArcEnt work? it is
(<Entity name: 1b8b5d8> (110.363 92.1785 0.0))

I must have slept through that class :shock:



Here is the revised routine


Code: [Select]
;;;   By Charles Alan Butler  : Last Modified 11/19/03
;;;   ArcC.lsp    (Arc Leader with Circle Arrow Head)
;;;   Uses the current layer & Circle Arrow head

;; error function & Routine Exit
(defun *error* (msg)
  (if
    (not
      (member
msg
'("console break" "Function cancelled" "quit / exit abort")
      )
    )
     (princ (strcat "\nError: " msg))
  ) ; if
  (princ)
) ;
;end error function

;;;======  Main Lisp Routine  =======
(defun c:ArcC (/ usercmd   useros    pt1       pt2
      pttemp ptpick   L_Angle   cenpt     rad
      StartAng arcdata   EndAng    
     )
  (princ "\n")
  (princ "\n       Arc Leader w/ Circle Arrow - Version 1.0")
  (princ "\n")

;;; -------  Some Housekeeping   ------------------
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "osmode" 0)
  (setq userANGDIR (getvar "angdir"))
  (setvar "angdir" 0)

  (setq ptpick (getpoint "\nPick leader start point: "))
  (command "arc" ptpick pause pause)
  (if (= "ARC" (cdr (assoc 0 (entget (entlast)))))
    (progn
      (setq ArcEnt (list (entlast) ptpick))
      (setq arcdata  (entget (entlast))
   cenpt    (cdr (assoc 10 arcdata))
   rad     (cdr (assoc 40 arcdata))
   StartAng (cdr (assoc 50 arcdata))
   EndAng   (cdr (assoc 51 arcdata))
      )
      (Command "_.Circle" ptpick 2) ; circle arrow head 2" radius
      (command "_trim" (entlast) "" ArcEnt "")
       ;;;==========  Exit Sequence  ============
      (setvar "osmode" useros)
      (setvar "CMDECHO" usercmd)
      (setvar "angdir" userangdir)
      (princ)
    ) ; end progn
  ) ; endif ARC
) ;  end defun
(prompt "\nType  ArcC  to run")
(princ)

;;;==========  End of Routine  ============
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.

DParcon

  • Guest
Arc Trim ??
« Reply #3 on: November 19, 2003, 08:11:22 PM »
ArcEnt always is the arc endpoint inside the
 circle. Try compare the center of the circle to
 the entity list of the arc ename (ArcEnt). The
 2 points are always identical.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Arc Trim ??
« Reply #4 on: November 19, 2003, 09:31:33 PM »
I guess my question is how does adding the center point onto the entity name work? I've never seen that before

Code: [Select]
 (setq ArcEnt (entlast))  

versus this

Code: [Select]
(setq ArcEnt (list (entlast) ptpick))

it's just that I want understand it so i'm able to use it again.
Is it a selection method that lets you pick an entity at a certin point  as if you picked it
with the cursor?

This is really neat. :D

Thanks

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.

DParcon

  • Guest
Arc Trim ??
« Reply #5 on: November 19, 2003, 10:53:47 PM »
<<it's just that I want understand it so i'm able to use it again.
  <<Is it a selection method that lets you pick an entity at a certin
  << point as if you picked it with the cursor?

  Yes, the code is the equivalent of (entsel) without
  user intervention (no picking of object). This trick is
  aka Version R9/R10.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Arc Trim ??
« Reply #6 on: November 22, 2003, 08:05:28 AM »
<<<Yes, the code is the equivalent of (entsel) without
<<<user intervention (no picking of object). This trick is
<<<aka Version R9/R10.

Definitely missed that Class, I just started Acad with 2000.

Can't wait to use it again. :)

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.