Author Topic: to get all ent start point and endpoint -> break mid distance  (Read 2629 times)

0 Members and 1 Guest are viewing this topic.

dussla

  • Bull Frog
  • Posts: 297
hello , friend   

for help some  ,  i come in theswamp

although i studied lisp , it is difficult to me


blelow routine :   
  1. to get  lines( lw , polyline , arc ,,,, )'s   start and end point

  2.  shorten  some distance

  3.  break middle distance  . then  create 2  obj

  4.   first obj ->   + 20 offset     , second obj  -> -20 offset



problem

  if you see my routine , that is problme and must add some routine






 (defun c:arpts()
   (vl-load-com)
   (setvar "osmode" 0 )
      (setq ent (car (entsel "\nSelect : ")))
      (setq ed (entget ent))
      (setq db0 (cdr (assoc 0 ed)))
      (setq D (getdist "\nEnter setback distance (negative to shorten): "))
      (SETQ D ( * D -1))
      
      (cond
         ( (= db0 "LINE")
              (setq start (cdr (assoc 10 ed)))
         (setq end (cdr (assoc 11 ed)))
         (command "._lengthen" ent "de" D start end "")
         (setq  new-ent (entlast))
         
         ; NEED ROUTINE THAT    ; BREAK  OBJ'S MIDDLE
         
             
         )
      
      
         ( (= db0 "LWPOLYLINE")
           
         (setq Start (assoc 10 ed))
         (setq End (assoc 10 (reverse ed)))
         (command "._lengthen" ent "de" D start end "")
         (setq  new-ent (entlast))
         
         ; NEED ROUTINE THAT    ; BREAK  OBJ'S MIDDLE
      )   
      
      
       ( (= db0 "POLYLINE")
           
         (setq OBJ (vlax-ename->vla-object  ent ))
         (setq objtype (vla-get-objectname obj))
         (setq Start (vlax-get objtype "startpoint"))
         (setq End  (vlax-get objtype "endpoint") )
         (command "._lengthen" ent "de" D start end "")
         (setq  new-ent (entlast))
         
         ; NEED ROUTINE THAT    ; BREAK  OBJ'S MIDDLE
         
         )
           
         ( (= db0 "ARC")
         (setq OBJ (vlax-ename->vla-object  ent ))
         (setq objtype (vla-get-objectname obj))
         (setq Start (vlax-get objtype "startpoint"))
         (setq End  (vlax-get objtype "endpoint") )
         (command "._lengthen" ent "de" D start end "")
         (setq  new-ent (entlast))
         
         ; NEED ROUTINE THAT    ; BREAK  OBJ'S MIDDLE

         
             
         ( (= db0 "CIRCLE")
                   
         
       )
           
           
      );cond end
    


 


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: to get all ent start point and endpoint -> break mid distance
« Reply #1 on: May 02, 2008, 09:03:11 AM »
Try something like this:
Code: [Select]
(defun c:arpts (/ ent ed d start end)
  (vl-load-com)
  (setvar "osmode" 0)
  (setq gap 20) ; 1/2 the actual gap
  (if
    (and
      (setq ent (car (entsel "\nSelect : ")))
      (setq ed (entget ent))
      (member (cdr (assoc 0 ed)) '("LINE" "LWPOLYLINE" "POLYLINE" "ARC"))
      (setq D (getdist "\nEnter setback distance (negative to shorten): "))
    )
     (progn
       (setq start (vlax-curve-getstartpoint ent)
             end   (vlax-curve-getendpoint ent)
       )
       (command "._lengthen" ent "de" D "non" start "non" end "")

       (setq middist
              (/ (vlax-curve-getdistatpoint ent (vlax-curve-getendpoint ent))
                 2
              )
       )
       (command "._break"
                (list ent start)
                "f"
                (vlax-curve-getpointatdist ent (- midDist gap))
                (vlax-curve-getpointatdist ent (+ midDist gap))
       )
     )
  )
  (princ)
)
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.

dussla

  • Bull Frog
  • Posts: 297
Re: to get all ent start point and endpoint -> break mid distance
« Reply #2 on: May 02, 2008, 09:15:25 AM »
thank you good lisp always

cab  and other friends
my last purpose  is to make  3d frame window.
can you see my attached file .

that is really ugly code for my poor coding   and have many error.
but you can understand my purpose

can you help me again .
can you diet  this code ~


problem :

1. there is gap in glass
2. some ucs error
3. glass position  in frame  : current  ( frame out postion  ->  in frame middle ) 
    that  need glass postion offset
4. that image is single frame window  ,  i need double window  in frame

« Last Edit: May 02, 2008, 09:30:34 AM by dussla »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: to get all ent start point and endpoint -> break mid distance
« Reply #3 on: May 02, 2008, 10:17:51 AM »
You may get some help but with a lisp this large it is better to break out a specific area where the problem is.
Then ask for help i a new thread for that problem.
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.

dussla

  • Bull Frog
  • Posts: 297
Re: to get all ent start point and endpoint -> break mid distance
« Reply #4 on: May 03, 2008, 06:34:14 AM »
cab  , thank you good advice
i made     compact code

but that is problem


1.

 (rect-frame  obj-1 40  zmove2  1)      <----  ----------- this is work well
 (vla-update (vlax-get-acad-object))
 (setq start (vlax-curve-getstartpoint glass-obj)    end   (vlax-curve-getendpoint glass-obj) )
 (command "._lengthen" glass-obj "de" -40 "non" start "non" end "")
   
   
 (rect-frame  glass-obj 10  ( - zmove2  ( * 40 2) ) 1)  <---------------- but this is error  error: unable to get ObjectID: nil


2. rect-frame is some ugly
 pls    can you modify some  with compact     :oops: :oops: :oops:

DEVITG

  • Bull Frog
  • Posts: 481
Re: to get all ent start point and endpoint -> break mid distance
« Reply #5 on: May 03, 2008, 08:37:55 AM »
On what acad do you work on?
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

dussla

  • Bull Frog
  • Posts: 297
Re: to get all ent start point and endpoint -> break mid distance
« Reply #6 on: May 03, 2008, 08:29:58 PM »
yes devig~
my purpose  is  3d  custome window making lisp

 :-) :-) :-) :-)

DEVITG

  • Bull Frog
  • Posts: 481
Re: to get all ent start point and endpoint -> break mid distance
« Reply #7 on: May 03, 2008, 08:51:46 PM »
yes devig~
my purpose  is  3d  custome window making lisp

 :-) :-) :-) :-)


On what acad version  do you work??
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

dussla

  • Bull Frog
  • Posts: 297
Re: to get all ent start point and endpoint -> break mid distance
« Reply #8 on: May 03, 2008, 09:00:13 PM »
yes  , i use acad 2004

i modified some cutome prompt
see attachted file~
« Last Edit: May 04, 2008, 07:06:28 AM by dussla »

dussla

  • Bull Frog
  • Posts: 297
Re: to get all ent start point and endpoint -> break mid distance
« Reply #9 on: May 05, 2008, 10:56:48 PM »
dear cab and friends  , thank you good help
i need one more time help again  :oops:

cab
if you see your arpts fuction is very good
but i need more addition routine
pls help me

1. select  entry
2. if i choose break number (ex: 5) , then  entry broken
3. after that ,  all broken  entities   lenghten each  with my wanted number
4. after that , i would liek to  add all entries broken  to  1 selection set


vlx funnction  is difficult to me still  :oops: :oops:
sorry my many ask
beg your pardon~
« Last Edit: May 06, 2008, 10:45:12 PM by dussla »