+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 23
  1. #11
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,232

    Default

    Registered forum members do not see this ad.

    Slightly different than I proposed with polygon - now obtaining points directly from middle distance of 2 radius...

    Code:
    (defun c:trim_between_2_concentic_circles ( / inner_circle outer_circle c1 c2 c r1 r2 r k p pl )
    
      (setq inner_circle (car (entsel "\nPick inner circle")))
      (setq outer_circle (car (entsel "\nPick outer circle")))
      (setq c1 (cdr (assoc 10 (entget inner_circle))))
      (setq c2 (cdr (assoc 10 (entget outer_circle))))
      (setq c (mapcar '* (mapcar '+ c1 c2) '(0.5 0.5 0.5)))
      (setq r1 (cdr (assoc 40 (entget inner_circle))))
      (setq r2 (cdr (assoc 40 (entget outer_circle))))
      (setq r (/ (+ r1 r2) 2.0))
      (setq k -1.0)
      (repeat 360
        (setq p (polar c (cvunit (setq k (1+ k)) "degrees" "radians") r))
        (setq pl (cons p pl))
      )
      (setq pl (cons (polar c 0.0 r) pl))
      (command "_.trim" inner_circle outer_circle "" "_F")
      (foreach p pl
        (command p)
      )
      (while (> (getvar 'cmdactive) 0) (command ""))
      (princ)
    )
    
    (defun c:tb2cc nil (c:trim_between_2_concentic_circles))
    HTH, M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  2. #12
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,500

    Default

    Thank you marko. Works like a charm.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  3. #13
    Junior Member
    Computer Details
    sidhu412's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Optiplex 9020
    Discipline
    Landscape
    sidhu412's Discipline Details
    Occupation
    Snr. CAD Designer
    Discipline
    Landscape
    Using
    AutoCAD 2014
    Join Date
    Oct 2011
    Location
    Saudi Arabia
    Posts
    21

    Default

    Quote Originally Posted by ReMark View Post
    I can't because I don't have a link to it. Anyway, it did work the first time I used it in a test drawing but on two subsequent attempts in the same drawing it failed to work (it did trim but the results were not what was seen first time round). I don't know why that is. I'm still in "test" mode.

    Second test failed. I guess it's back to searching for an answer.

    Sorry about that.
    It's ok no problem.

    I found the LISP Code on the link given by OMEGA-ThundeR and tried it. But it can only trim the lines intersecting the Closed Objects. FYI, I drew the Circle just to let people understand my query otherwise I have sets of Open Polylines including Arcs & Straight Lines (irregular) So The MEXTRIM or the Polygon method (Described by Mr. Marko-Ribar) will not work.
    will be grateful if there's something else you guys can do.

    Thank you,

    Regards,


    Sidhu

  4. #14
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro K4200, 4GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2018
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    46,500

    Default

    sidhu: Did you not see the new lisp program marko included in his last post? It does what you asked for. Check it out.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  5. #15
    Junior Member
    Computer Details
    sidhu412's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Optiplex 9020
    Discipline
    Landscape
    sidhu412's Discipline Details
    Occupation
    Snr. CAD Designer
    Discipline
    Landscape
    Using
    AutoCAD 2014
    Join Date
    Oct 2011
    Location
    Saudi Arabia
    Posts
    21

    Default

    Quote Originally Posted by marko_ribar View Post
    Slightly different than I proposed with polygon - now obtaining points directly from middle distance of 2 radius...

    Code:
    (defun c:trim_between_2_concentic_circles ( / inner_circle outer_circle c1 c2 c r1 r2 r k p pl )
    
      (setq inner_circle (car (entsel "\nPick inner circle")))
      (setq outer_circle (car (entsel "\nPick outer circle")))
      (setq c1 (cdr (assoc 10 (entget inner_circle))))
      (setq c2 (cdr (assoc 10 (entget outer_circle))))
      (setq c (mapcar '* (mapcar '+ c1 c2) '(0.5 0.5 0.5)))
      (setq r1 (cdr (assoc 40 (entget inner_circle))))
      (setq r2 (cdr (assoc 40 (entget outer_circle))))
      (setq r (/ (+ r1 r2) 2.0))
      (setq k -1.0)
      (repeat 360
        (setq p (polar c (cvunit (setq k (1+ k)) "degrees" "radians") r))
        (setq pl (cons p pl))
      )
      (setq pl (cons (polar c 0.0 r) pl))
      (command "_.trim" inner_circle outer_circle "" "_F")
      (foreach p pl
        (command p)
      )
      (while (> (getvar 'cmdactive) 0) (command ""))
      (princ)
    )
    
    (defun c:tb2cc nil (c:trim_between_2_concentic_circles))
    HTH, M.R.
    Sir,

    It works fine but still I need to specify the Fence Path. This is 90% of what I need. If you can only edit it little bit and remove the Fence Function, So it will trim every Line in between the Circel / Polyline 1 & Circle / Polyline 2.


    Regards,


    Sidhu
    Last edited by sidhu412; 21st Aug 2014 at 01:34 pm.

  6. #16
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,232

    Default

    sidhu412, If your concentric circles lie in some UCS different than WCS, I suggest that you use this revision (also added OSMODE checking - you can add this 2 first lines and in previous code and one last before (princ))

    Code:
    (defun c:trim_between_2_concentic_circles ( / osm inner_circle outer_circle c1 c1w c2 c2w cw c r1 r2 r k p pl )
    
      (setq osm (getvar 'osmode))
      (setvar 'osmode 0)
      (setq inner_circle (car (entsel "\nPick inner circle")))
      (while (/= (cdr (assoc 0 (entget inner_circle))) "CIRCLE")
        (prompt "\nPicked entity isn't circle entity, try again...")
        (setq inner_circle (car (entsel "\nPick inner circle")))
      )
      (setq outer_circle (car (entsel "\nPick outer circle")))
      (while (/= (cdr (assoc 0 (entget outer_circle))) "CIRCLE")
        (prompt "\nPicked entity isn't circle entity, try again...")
        (setq outer_circle (car (entsel "\nPick outer circle")))
      )
      (setq c1 (cdr (assoc 10 (entget inner_circle))))
      (setq c1w (trans c1 inner_circle 0))
      (setq c2 (cdr (assoc 10 (entget outer_circle))))
      (setq c2w (trans c2 outer_circle 0))
      (setq cw (mapcar '* (mapcar '+ c1w c2w) '(0.5 0.5 0.5)))
      (setq c (trans cw 0 1))
      (setq r1 (cdr (assoc 40 (entget inner_circle))))
      (setq r2 (cdr (assoc 40 (entget outer_circle))))
      (setq r (/ (+ r1 r2) 2.0))
      (setq k -1.0)
      (repeat 360
        (setq p (polar c (cvunit (setq k (1+ k)) "degrees" "radians") r))
        (setq pl (cons p pl))
      )
      (setq pl (cons (polar c 0.0 r) pl))
      (command "_.trim" inner_circle outer_circle "" "_F")
      (foreach p pl
        (command p)
      )
      (while (> (getvar 'cmdactive) 0) (command ""))
      (setvar 'osmode osm)
      (princ)
    )
    
    (defun c:tb2cc nil (c:trim_between_2_concentic_circles))
    BTW. This code by OMEGA-ThundeR is more general and I strongly suggest that you use it in many various situations, where EXTRIM can't provide desired results...

    Code:
    ;;; FenceTRim
    
    (Defun C:ftr ()
      (command "_trim" pause pause "" "f")
      (princ)
    )
    Regards, M.R.
    Last edited by marko_ribar; 21st Aug 2014 at 02:31 pm.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  7. #17
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,232

    Default

    Here is another approach... Try it and see if you get desired results...

    Load posted code :

    Code:
    (defun colect_entdata ( / ss i ent entdata )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdata (cons (entget ent) entdata))
      )
      entdata
    )
    
    (defun c:store_entdata nil
      (setq entdata (colect_entdata))
      (princ)
    )
    
    ;;; Modify entities ;;;
    
    (defun colect_modified_entdata ( / ss i ent entdatachk entdatamod )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdatachk (cons (entget ent) entdatachk))
      )
      (foreach data entdatachk
        (if (not (vl-some '(lambda ( x ) (equal x data 1e-6)) entdata))
          (setq entdatamod (cons data entdatamod))
        )
      )
      entdatamod
    )
    
    (defun c:sel_mod_ents ( / ss )
      (setq ss (ssadd))
      (foreach data (colect_modified_entdata)
        (ssadd (cdr (assoc -1 data)) ss)
      )
      (sssetfirst nil ss)
      (princ)
    )
    
    (alert "\nFirstly type : store_entdata \nThen modify entities \nFinally type : sel_mod_ents \nAt the end type : (setq entdata nil)")
    (princ)
    1. Firstly type : store_entdata
    2. Use "EXTRIM" command - pick first curve and pick point inside area you want to be extrimmed...
    3. Type : sel_mod_ents
    4. Press ctrl+shift+c (copybase) and enter point : 0,0,0
    5. Type : (setq entdata nil)
    6. Type : U (undo) - drawing should be exactly like starting - before 2. process
    7. Use "EXTRIM" command - pick second curve and pick point inside area you want to be extrimmed...
    8. Press ctrl+v (paste) and enter point : 0,0,0

    That's it... Try it and tell me how it works...
    HTH, M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  8. #18
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,232

    Default

    I thought, why wouldn't I automate this steps into single lisp, and I did it... So try this version...

    Code:
    (defun colect_entdata ( / ss i ent entdata )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdata (cons (entget ent) entdata))
      )
      entdata
    )
    
    (defun store_entdata nil
      (setq entdata (colect_entdata))
      (princ)
    )
    
    ;;; Modify entities ;;;
    
    (defun colect_modified_entdata ( / ss i ent entdatachk entdatamod )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdatachk (cons (entget ent) entdatachk))
      )
      (foreach data entdatachk
        (if (not (vl-some '(lambda ( x ) (equal x data 1e-6)) entdata))
          (setq entdatamod (cons data entdatamod))
        )
      )
      entdatamod
    )
    
    (defun sel_mod_ents nil
      (setq ss (ssadd))
      (foreach data (colect_modified_entdata)
        (ssadd (cdr (assoc -1 data)) ss)
      )
      (princ)
    )
    
    ;;; Main command function ;;;
    
    (defun c:extrim_between_2_curves ( / hig osm c1 c2 p ss entdata )
    
      (vl-load-com)
    
      (setq hig (getvar 'highlight))
      (setq osm (getvar 'osmode))
      (setvar 'osmode 0)
      (if (not (or etrim (not (vl-catch-all-error-p (vl-catch-all-apply 'load (list (findfile "extrim.lsp")))))))
        (progn
          (alert "\nExpress Tool EXTRIM not available - quitting...")
          (exit)
        )
      )
      (setq c1 (car (entsel "\nPick first curve")))
      (while (not (numberp (vlax-curve-getstartparam c1)))
        (prompt "\nPicked entity isn't curve entity. Try again...")
        (setq c1 (car (entsel "\nPick first curve")))
      )
      (setq c2 (car (entsel "\nPick second curve")))
      (while (not (numberp (vlax-curve-getstartparam c2)))
        (prompt "\nPicked entity isn't curve entity. Try again...")
        (setq c2 (car (entsel "\nPick second curve")))
      )
      (initget 1)
      (setq p (getpoint "\nPick or specify point between 2 prviously picked curves where do you want extrim to be processed : "))
      (store_entdata)
      (etrim c1 p)
      (sel_mod_ents)
      (command "_.copybase" '(0.0 0.0 0.0) ss "")
      (command "_.undo" "3")
      (etrim c2 p)
      (command "_.pasteclip" '(0.0 0.0 0.0))
      (setvar 'osmode osm)
      (setvar 'highlight hig)
      (princ)
    )
    
    (defun c:exb2c nil (c:extrim_between_2_curves))
    HTH, M.R.
    Regards...
    Last edited by marko_ribar; 22nd Aug 2014 at 11:21 am.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  9. #19
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,882

    Default

    oops forgot to read page two

    A facet.lsp anyway for something like this problem a few extra lines and done trim between two circles. Like above new rad is just (rad1+rad2)/2, pick two circles then trim using Fence avoids using vlax-curve old fashioned lisp.

    Code:
    (setq num (getreal "\nEnter number of facets"))
    (setq rad (getreal "\nEnter radius"))
    (setq cenpt (getpoint "\nPick centre pt"))
    (setq ang 0.0)
    (setq angdiff (/ (* pi 2.0) num))
    (repeat (fix num)
    (setq pt1 (polar cenpt ang rad)) 
    (setq facets (cons pt1 facets))
    (setq ang (+ angdiff ang))
    )
    (princ facets)
    Last edited by BIGAL; 22nd Aug 2014 at 04:20 am. Reason: read page 2
    A man who never made mistakes never made anything

  10. #20
    Junior Member
    Computer Details
    sidhu412's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell Optiplex 9020
    Discipline
    Landscape
    sidhu412's Discipline Details
    Occupation
    Snr. CAD Designer
    Discipline
    Landscape
    Using
    AutoCAD 2014
    Join Date
    Oct 2011
    Location
    Saudi Arabia
    Posts
    21

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by marko_ribar View Post
    I thought, why wouldn't I automate this steps into single lisp, and I did it... So try this version...

    Code:
    (defun colect_entdata ( / ss i ent entdata )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdata (cons (entget ent) entdata))
      )
      entdata
    )
    
    (defun store_entdata nil
      (setq entdata (colect_entdata))
      (princ)
    )
    
    ;;; Modify entities ;;;
    
    (defun colect_modified_entdata ( / ss i ent entdatachk entdatamod )
      (setq ss (ssget "_X"))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (setq entdatachk (cons (entget ent) entdatachk))
      )
      (foreach data entdatachk
        (if (not (vl-some '(lambda ( x ) (equal x data 1e-6)) entdata))
          (setq entdatamod (cons data entdatamod))
        )
      )
      entdatamod
    )
    
    (defun sel_mod_ents nil
      (setq ss (ssadd))
      (foreach data (colect_modified_entdata)
        (ssadd (cdr (assoc -1 data)) ss)
      )
      (princ)
    )
    
    ;;; Main command function ;;;
    
    (defun c:extrim_between_2_curves ( / hig osm c1 c2 p ss entdata )
    
      (vl-load-com)
    
      (setq hig (getvar 'highlight))
      (setq osm (getvar 'osmode))
      (setvar 'osmode 0)
      (if (not (or etrim (not (vl-catch-all-error-p (vl-catch-all-apply 'load (list (findfile "extrim.lsp")))))))
        (progn
          (alert "\nExpress Tool EXTRIM not available - quitting...")
          (exit)
        )
      )
      (setq c1 (car (entsel "\nPick first curve")))
      (while (not (numberp (vlax-curve-getstartparam c1)))
        (prompt "\nPicked entity isn't curve entity. Try again...")
        (setq c1 (car (entsel "\nPick first curve")))
      )
      (setq c2 (car (entsel "\nPick second curve")))
      (while (not (numberp (vlax-curve-getstartparam c2)))
        (prompt "\nPicked entity isn't curve entity. Try again...")
        (setq c2 (car (entsel "\nPick second curve")))
      )
      (initget 1)
      (setq p (getpoint "\nPick or specify point between 2 prviously picked curves where do you want extrim to be processed : "))
      (store_entdata)
      (etrim c1 p)
      (sel_mod_ents)
      (command "_.copybase" '(0.0 0.0 0.0) ss "")
      (command "_.undo" "3")
      (etrim c2 p)
      (command "_.pasteclip" '(0.0 0.0 0.0))
      (setvar 'osmode osm)
      (setvar 'highlight hig)
      (princ)
    )
    
    (defun c:exb2c nil (c:extrim_between_2_curves))
    HTH, M.R.
    Regards...
    Bingooooooooooo

    Great.........!
    That's 100% What I needed You are Genius Mr. Marko_Ribar.

    Thanxxxxxx a lot

    Regards,


    Sidhu

Similar Threads

  1. Adding " Extrim" command to my Tool Platte
    By samifox in forum AutoCAD General
    Replies: 2
    Last Post: 31st Jan 2013, 04:49 pm
  2. Extrim not working in lisp
    By BIGAL in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 28th Jan 2013, 12:53 am
  3. 2D circle jagged lines, 3D model " hidden" jagged lines. How do i get smooth lines?
    By richarda2012 in forum AutoCAD 3D Modelling & Rendering
    Replies: 8
    Last Post: 13th Oct 2012, 09:21 am
  4. Extrim command
    By chizifreshi in forum AutoCAD General
    Replies: 5
    Last Post: 30th Jan 2012, 02:57 pm
  5. Replies: 16
    Last Post: 3rd Dec 2008, 03:45 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts