See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Help me with trim at point in lisp routine

  1. #1
    Member
    Join Date
    2001-04
    Posts
    3
    Login to Give a bone
    0

    Default Help me with trim at point in lisp routine

    Hello,

    I have a problem since I work with the 2010 version of Civil3D. Previously, this routine worked well, but since the 2010 version, I have a problem with the trim in the center of the circle. At this point, the routine stops and a selection window appears.

    Can you help me work around this problem?

    Here is the lisp program.

    Code:
    (DEFUN c:bfo (/ p1 lay)
      (command "ucs" "w")
      (command "osnap" "NEA")
      (setq	P1  (getpoint "\n point the CONNECTION TO WATER SUPPLY > ")
    	LAY (cdr (assoc 8 (entget (ssname (ssget P1) 0))))
    	AQU (ssname (ssget P1) 0)
      )					
      (prompt "\n Place the standpipe > ")
      (command "circle" P1 (* #SC# 1.04))
      (setq CI (entlast))
      (command "move" CI "" P1 pause)
      (setq PP2 (cdr (assoc 10 (entget CI))))
      (command "layer" "s" LAY "")
      (prompt "\n point the water supply > ")
      (COMMAND "OSNAP" "PER")
      (command "line" PP2 pause "")
      (command "aperture" "1")
      (command "pickbox" "1")
      (command "osnap" "none")
    
      (command "trim" CI "" PP2 "") <<--- This is where it stops 
      (command "erase" CI "")
    
      (command "aperture" "3")
      (command "pickbox" "5")
      (prompt "\n standpipe rotation > ")
    
      (if (wcmatch LAY "*_N_*")
        (command "insert" "bor_fo_p" PP2 #SC# "" pause)
        (command "insert" "bor_fo_e" PP2 #SC# "" pause)
      )					
      (command "ucs" "p")
    )
    Thank you.
    Last edited by Opie; 2010-02-22 at 04:58 PM. Reason: [code] tags added

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Help me with trim at point in lisp routine

    Check what represent PP2 point
    (cdr (assoc 10 CI)) is probably center of circle, as circle doesn't have start and endpoint (it's defined by center and radius or diameter)...

    So if you trim by picking center of circle it's like picking no point at all. This is why it does nothing at (command "trim" CI "" PP2 "")...

  3. #3
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Help me with trim at point in lisp routine

    Command "trim" works like this:
    1. pick object that defines with what you want to trim...
    2. pick object that trims to that object...

    If you first pick line at PP2 point (center of circle), and then trim circle with point on it, it will trim circle and will work if line crosses circle. But if you first pick circle and then you pick point PP2 on line, it will trim line also only if it crosses circle. So, probably your line doesn't intersect with circle, with what you want to trim line...

    Try to use "extrim" command from express tools to trim everything inside circle by entering PP2 (center) as side on which "extrim" refers to...

  4. #4
    Member
    Join Date
    2001-04
    Posts
    3
    Login to Give a bone
    0

    Default Re: Help me with trim at point in lisp routine

    Ok, I understand very well for what is the center of the circle.

    Regarding the command Extrim I had thought, but I just wanted to trim the line drawn by the routine, no other objects that might be found inside the circle.

    Is there no other way to trim the boundary line of the circle?

  5. #5
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Help me with trim at point in lisp routine

    If you want to trim boundary line of circle, you have to select first line for trimming, and then to pick point on circle on the side you want to trim...
    If you want to trim line that is crossing circle, as I think you want, than that line must cross circle, and you should select circle for trimming first and then pick point on line PP2. Maybe the problem is that you turned osnap variable "osmode" to 0 (none), and when it tries to pick PP2 because of aperture and pickbox is too small (1) it misses that PP2. -> it asks to select what to trim...
    Try to set "OSNAP" to "END" or "END, MID, INT", witch is equal to line :
    (setvar "osmode" 35)

  6. #6
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    1

    Default Re: Help me with trim at point in lisp routine

    You could generate a pick-point selection to pass to trim instead. See what's given by an entsel call - you should make the same thing from entlast after drawing the line and append the point to pick.

    BTW, why not simply modify the line instead? You seem to want to have a line drawn from a circle's center & then trim it to only display outside the circle. You could subst the line's code 10 by calculating a new point using polar & angle. Then an entmod would stretch the line.

  7. #7
    Member
    Join Date
    2001-04
    Posts
    3
    Login to Give a bone
    0

    Default Re: Help me with trim at point in lisp routine

    Thank you,

    I believe I have solved my problem.

    I added 1 line to my routine, and modify the TRIM comamand line.

    Now it looks like this:

    Code:
    (DEFUN c:bfo (/ p1 lay)
    (command "ucs" "w")
    (command "osnap" "NEA")
    (setq P1 (getpoint "\n point the CONNECTION TO WATER SUPPLY > ")
    LAY (cdr (assoc 8 (entget (ssname (ssget P1) 0))))
    AQU (ssname (ssget P1) 0)
    )
    (prompt "\n Place the standpipe > ")
    (command "circle" P1 (* #SC# 1.04))
    (setq CI (entlast))
    (command "move" CI "" P1 pause)
    (setq PP2 (cdr (assoc 10 (entget CI))))
    (command "layer" "s" LAY "")
    (prompt "\n point the water supply > ")
    (COMMAND "OSNAP" "PER")
    (command "line" PP2 pause "")
    
    (setq #lig# (entlast))   <<--- This is the new line
    
    (command "aperture" "3")
    (command "pickbox" "3")
    (command "osnap" "none")
    
    ;(command "trim" CI "" PP2 "") <<--- This is the old trim command line
    
    (command "trim" CI "" #lig# "") <<--- This is the new trim command line
    
    
    (command "erase" CI "")
    
    (command "aperture" "3")
    (command "pickbox" "5")
    (prompt "\n standpipe rotation > ")
    
    (if (wcmatch LAY "*_N_*")
    (command "insert" "bor_fo_p" PP2 #SC# "" pause)
    (command "insert" "bor_fo_e" PP2 #SC# "" pause)
    )
    (command "ucs" "p")
    )

    I tested and it works.

Similar Threads

  1. Routine to trim a Line with half a Circle
    By cadd4la in forum AutoLISP
    Replies: 15
    Last Post: 2006-11-19, 05:14 AM
  2. LISP routine to draw area of fill from point Blocks
    By jchinchilla in forum AutoLISP
    Replies: 1
    Last Post: 2006-05-22, 08:56 PM
  3. Mass trim/extend routine
    By GreyHippo in forum AutoLISP
    Replies: 18
    Last Post: 2005-09-13, 09:02 PM
  4. Break / Trim button routine issue
    By TimTheriault in forum AutoCAD Customization
    Replies: 12
    Last Post: 2005-08-11, 07:52 PM

Posting Permissions

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