Jump to content

Need code to send a "CP" command


cabltv1

Recommended Posts

Please help!

I have a routine that will update a block attribute from another block attribute. It works well and is quite versatile.

Anyway, after selecting the source block the code asks to "Select Addresses" [see below]. At that point I have to type "CP" into the command window and hit the Enter key to select blocks with a polygon. I would like the code to go into the "CP" mode without me having to type it in.

 

 
 ;reset variables
 (setq tag_found nil)
 (setq setset nil)
  ; get end block
  (while (/= tag_found "true")
  (princ "\nSelect Addresses ")(princ (chr 34))(princ stag_end)(princ (chr 34))
  (setq selset  (ssget '((0 . "INSERT"))))

 

Thanks for any help.

Link to comment
Share on other sites

I appreciate the response but that won't solve my problem.

Normally, selections are oddly shapped. I need to just select the blocks that need updated. The selection may include 12 or more oddly shapped points.example.bmp

Link to comment
Share on other sites

No that doesn't work, if you use "cp" with ssget you need to supply a point list.

 

I was thinking use (command "select" "cp" ....) then (ssget "p" etc.. but I couldn't get the "select" to end without user hitting "enter" so it doesn't save eliminate those dratted keystrokes :)

Link to comment
Share on other sites

;reset variables
 (setq tag_found nil)
 (setq setset nil)
; get end block
  (while (/= tag_found "true")
      (princ "\nSelect Addresses ")
      (princ (chr 34))
      (princ stag_end)
      (princ (chr 34))
      (command "select" "cp")
      (setq selset  (ssget "p" '((0 . "INSERT"))))

works though. It's kinda ugly. I would prefer personally to not have the select prompt vanish automatically anyway.

Link to comment
Share on other sites

Well the code does stop and lets me polygon around the blocks but the code won't run past that point.

I appreciate everyones help. I guess I will have to live with the original code.

 

Thanks again.

Link to comment
Share on other sites

No matter what you do you will have to tell the program when to stop when making a crossing polygon because it could be 3 points or 300. if you don’t want to hit the enter key change your right click on the mouse to be enter.

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...