Jump to content

Select by ssget windows but it not done. Help


Nad SK

Recommended Posts

I have stusk with this code. Who knows about that please show me. Thank. I want to select all the text in the window on layer Note

(while
 (setvar "osmode" 32)
 (SETQ p ( getpoint "\nPick point"))
 (setvar "osmode" 0)
 (setq p1 (polar p (/ (* pi 3) 4) 15)) 
 (setq p2 (polar p (/ pi -4) 15))
 ;(command "line" p1 p2 "") ;; OK
 (setq la (ssget "W" 'p1 'p2 '((0. "TEXT") (8. "Note"))));; Stusk here.
 (setq ds (ssget (list la ))

Edited by SLW210
Link to comment
Share on other sites

Perhaps this will get you started.

(defun C:Ctext (/ p p1 p2 la)
 (setvar "cmdecho" 0)
 (while
   (progn
    (setvar "osmode" 32)
    (setq p (getpoint "\nPick point"))
    (setvar "osmode" 0)
    (setq p1 (polar p (* pi 1.25) 50))
    (setq p2 (polar p (* pi 0.25) 50))
    ;(command "line" p1 p2 "")
    (if (setq la (ssget "C" p1 p2 '((0 . "TEXT") (8 . "Note"))))
      (progn
        (command "TEXT" "j" "mc" p 0 (rtos (sslength la) 2 2) "")
        ;(command "-LAYER" "s" 0 "")
      )
    )
   )
 )                 ; while
 (setvar "cmdecho" 1)
 (princ)
)                   ; end

Link to comment
Share on other sites

  • 5 years later...

Good morning/afternoon CAB,

This is some great code. Exactly what I've been looking for. But I still need your expertise. Can you explain what the 1.25 and 0.25 is doing? I understand the math. Also, the 50 value...is this a radius, or rectangle?

 

Here's my scenerio: Routine #1 draws a line and labels it at the midpoint with it's length text. Routine #2 then splits the line in to two parts, labels these 2 new parts. How can I use your approach to delete the old original piece of text? Can I set the SSGET crossing to a rectangular box....along the length of the original line?

 

Perhaps this will get you started.

(defun C:Ctext (/ p p1 p2 la)
 (setvar "cmdecho" 0)
 (while
   (progn
    (setvar "osmode" 32)
    (setq p (getpoint "\nPick point"))
    (setvar "osmode" 0)
    (setq p1 (polar p (* pi 1.25) 50))
    (setq p2 (polar p (* pi 0.25) 50))
    ;(command "line" p1 p2 "")
    (if (setq la (ssget "C" p1 p2 '((0 . "TEXT") (8 . "Note"))))
      (progn
        (command "TEXT" "j" "mc" p 0 (rtos (sslength la) 2 2) "")
        ;(command "-LAYER" "s" 0 "")
      )
    )
   )
 )                 ; while
 (setvar "cmdecho" 1)
 (princ)
)                   ; end

Link to comment
Share on other sites

The 1.25 and 0.25 are used to set the angle. The 50 is a distance value.

 

I'm not sure what you are trying to accomplish? Do you want the line to split at a predetermined point (ie. always the midpoint), or does the user specify a point to split the line at?

 

Good morning/afternoon CAB,

This is some great code. Exactly what I've been looking for. But I still need your expertise. Can you explain what the 1.25 and 0.25 is doing? I understand the math. Also, the 50 value...is this a radius, or rectangle?

 

Here's my scenerio: Routine #1 draws a line and labels it at the midpoint with it's length text. Routine #2 then splits the line in to two parts, labels these 2 new parts. How can I use your approach to delete the old original piece of text? Can I set the SSGET crossing to a rectangular box....along the length of the original line?

Link to comment
Share on other sites

Good afternoon CheSyn,

No, the user will pick the split point. I'm trying to delete the old original piece of text....by creating an SSGET crossing box....along the length of the original line?

 

I.E...When the use picks the split point anywhere along line A, I want to expand out from that point at the angle of line A searching for the piece of text to delete. There will be other lines with text labels on them nearby I don't want to delete. Just want to delete the text associated with the line the point was on...

 

Does that make sense?

 

Thanks for your help,

Mike

Link to comment
Share on other sites

I'm not sure how much text is in your drawing, but something like this could work. It just looks for text that has a value equal to the length of the line selected and at the same rotation. Let me know if something like this works for you.

 

   (setq line (car (entsel "\nSelect the line : ")))

       (setq start (cdr (assoc 10 (entget line)))
               end (cdr (assoc 11 (entget line)))
               ang (angle start end)
               dist (distance start end)
               diststr (rtos dist 2 2))

       (setq texset (ssget "_x" (list '(0 . "TEXT") (cons 1 diststr) (cons 50 ang))))
           (command "_.erase" texset "")

Link to comment
Share on other sites

Mike, It's often helpful to post a sample DWG so people can actually see what you are doing.

I'm packing for vacation tomorrow so no time on my end.

Looks like you are in good hands.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...