Jump to content

Recommended Posts

Posted

So I want to select all lines with hidden after a flatshot, and then change them to layer 7 which is the hidden lines layer.

 

Now I figured the following code out myself true the forums and tutorials.

 

(defun C:selh(/)
 	(prompt "\nSelect Objects by Window")
(setq p1 (getpoint "\nFirst Corner: "))
(setq p2 (getpoint p1 "\nSecond Corner: "))
(setq sel1 (ssget "w" p1 p2 '((0 . "HIDDEN")(8 . "0")))
(princ)
)

But like always it doesn't work :( (or at least it looks like that.)

And is there a quick way to test of the selection set is working?

Posted

And is there a quick way to test of the selection set is working?

at the command line start the Select command

at the Select objects: prompt enter !sel1 (the selected objects should be highlighted)

 

if you're trying to select the "line" entities on layer "0" with a "hidden" linetype in a window

   (setq p1 (getpoint "\nFirst Corner: "))
   (setq p2 (getcorner p1 "\nSecond Corner: "))
   (setq sel1 (ssget "_W" p1 p2 '((0 . "LINE") (8 . "0") (6 .  "HIDDEN"))))

Posted

Cool thanks for your reply, how did you know you had use the number 6?

Which manual or book should I get? :S

I btw get a bad ssget list argument back :(

This one seems to work

(defun C:selh(/)
    	(setq p1 (getpoint "\nFirst Corner: "))
   	(setq p2 (getcorner p1 "\nSecond Corner: "))
(setq sel1 (ssget "_W" p1 p2 '((6 . "HIDDEN")(8 . "0"))))
(princ)
)

Posted

(defun C:selh(/)
    	(setq p1 (getpoint "\nFirst Corner: "))
   	(setq p2 (getcorner p1 "\nSecond Corner: "))
(setq SS1 (ssget "_W" p1 p2 '((6 . "HIDDEN")(8 . "0"))))
 	(command "_.chprop" ss1 "" "la" "7" "")
 	(setq SS2 (ssget "_W" p1 p2 ))
   	(command "_.chprop" ss2 "" "la" "" "bylayer" "bylayer" "bylayer" "bylayer" "bylayer")
 (princ)
)

But

	(command "_.chprop" ss2 "" "la" "" "bylayer" "bylayer" "bylayer" "bylayer" "bylayer")

isn't correct I made it so everything but the line thickness get set right, but screwed it up while finding the line thickness.

Posted

Provide (command "_.chprop" with the 'arguments' as you would from the command line

Posted

Woot I did it and learned a lot of it :)

(must have code if you use flat-shot and hidden lines layer!!

(defun C:selh(/)
  (progn
    	(setq p1 (getpoint "\nFirst Corner: "))
   	(setq p2 (getcorner p1 "\nSecond Corner: "))
(setq SS1 (ssget "_W" p1 p2 '((6 . "HIDDEN")(8 . "0"))))
 	(command "_.chprop" ss1 "" "la" "7" "")
 	(setq SS2 (ssget "_W" p1 p2 ))
   	(command "_.chprop" ss2 "" "color" "ByLayer" "")
     	(command "_.chprop" ss2 "" "lweight" "bylayer" "")
     	(command "_.chprop" ss2 "" "ltype" "bylayer" "")
    )
 (princ)
)

Thanks for your help LP!

 

Edit: For everyone that want to use it: The 7 in (command "_.chprop" ss1 "" "la" "7" "") is the hidden layer and the 0 in (setq SS1 (ssget "_W" p1 p2 '((6 . "HIDDEN")(8 . "0")))) is the layer of the view.

Posted
Developer Documentation >acad_dev.chm

 

Also, sources of DXF codes

ah tnx never thought about looking for dxf reference :S

 

The code could btw work without the layer 0 filter just make a flatshot on any layer and the hidden lines to hidden.

Code would be:

(defun C:selh(/)
  (progn
    	(setq p1 (getpoint "\nFirst Corner: "))
   	(setq p2 (getcorner p1 "\nSecond Corner: "))
(setq SS1 (ssget "_W" p1 p2 '((6 . "HIDDEN"))))
 	(command "_.chprop" ss1 "" "la" "7" "")
 	(setq SS2 (ssget "_W" p1 p2 ))
   	(command "_.chprop" ss2 "" "color" "ByLayer" "")
     	(command "_.chprop" ss2 "" "lweight" "bylayer" "")
     	(command "_.chprop" ss2 "" "ltype" "bylayer" "")
    )
 (princ)
)

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