line on the correct layer please!

Discussion in 'AutoCAD' started by buttons129, Apr 3, 2004.

  1. buttons129

    buttons129 Guest

    this is a simple conceal routine but puts the `concealed' portion on the current layer rather than the layer the original line was on. Q is it a simple one to sort or MAJOR AG?.

    (defun c:CADcnR (/ PT1 PT2 AN1 PT4 PT3 PT6 PT5 )
    (graphscr)
    (setvar "cmdecho" 0)
    (setvar "osmode" 32)
    (setq PT1(getpoint "\nPick first intersection: "))
    (setq PT2(getpoint "\nPick second intersection: "))
    (setvar "osmode" 0)
    (setq AN1(angle PT1 PT2))
    (setq PT4(polar PT1 AN1 (* (getvar "dimscale") 0.5)))
    (setq PT3(polar PT1 (+ pi AN1) (* (getvar "dimscale") 0.5)))
    (setq PT6(polar PT2 AN1 (* (getvar "dimscale") 0.5)))
    (setq PT5(polar PT2 (+ pi AN1) (* (getvar "dimscale") 0.5)))
    (command "break" PT3 PT6)
    (command "line" PT4 PT5 "")
    (command "change" "l" "" "p" "lt" "hidden2" "c" "1" "")
    (princ)
    )
     
    buttons129, Apr 3, 2004
    #1
  2. buttons129

    bob.at Guest

    Try the following changes. Then the new line is on the layer of the object you first picked:
    change to
    (setq OB1 (entsel "\nPick first intersection: "))
    (setq PT1 (cdr OB1) LA1 (cdr (assoc 8 (entget (car OB1)))))

    and
    chang to
    (command "change" "l" "" "p" "lt" "hidden2" "c" "1" "la" LA1 "")
     
    bob.at, Apr 3, 2004
    #2
  3. buttons129

    buttons129 Guest

    Bob. on the `Pick first intersection' now i get a `pickt' box rather than osnap for intersect! then it bails out with a Code52#
     
    buttons129, Apr 3, 2004
    #3
  4. buttons129

    bob.at Guest

    Sorry, I missed your "intersection". Try the selection like this:

    (setq PT1(getpoint "\nPick first intersection: "))
    (setq OB1 (ssget PT1))
    (setq LA1 (cdr (assoc 8 (entget (ssname OB1 0)))))
    (setq PT2(getpoint "\nPick second intersection: "))

    but it is by chance, which of the two intersecting lines ist found first and determines the layer.
     
    bob.at, Apr 3, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.