See the top rated post in this thread. Click here

Results 1 to 9 of 9

Thread: Any wanna take a look on this?

  1. #1
    Member
    Join Date
    2015-04
    Posts
    4
    Login to Give a bone
    0

    Default Any wanna take a look on this?

    HI all

    I´m working this Lisp and to be honest I´m new to all this..

    LISP:

    Code:
    (Defun c:SGM (/ s ss sn i) 
     (foreach lay (layoutlist)
        (setvar 'ctab lay)
      (if (setq s  (ssadd)
            ss (ssget "_x" '((0 . "ARC,LINE,LWPOLYLINE") (8 . "GRUPPEOMRÅDE")))
          )
        (progn
          (repeat (setq i (sslength ss))
        (setq sn (ssname ss (setq i (1- i))))
        (if (not (eq (cdr (assoc 100 (reverse (entget sn))))
                 "AcDb3dPolyline"
             )
            )
          (ssadd sn s)
        )
          )
          (if (> (sslength s) 0)
        (command "_.pedit" "_m" s "" "w" 1.4 "")
          )
          (princ "\n .... ")
         )
           ); end foreach
        (princ "\n Couldn't find any 2D polyline !!")
      )
      (princ)
    )
    What it should do is: For each layout go to layer "Gruppeområde" select all lines, arcs ,polylines, 3d polylines and set width to 1.4.

    Any that can see what i do wrong?
    I get the error :"invalid window specification"
    Last edited by rkmcswain; 2016-04-28 at 06:28 PM. Reason: Changed [QUOTE] to [CODE] tags

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,100
    Login to Give a bone
    0

    Default Re: Any wanna take a look on this?

    You are not accounting for the value of the PEDITACCEPT system variable. If it is set at 0 and you select items which are not polylines, the prompt to convert them is presented.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Any wanna take a look on this?

    You can only set width to polylines, not lines or arcs. Are you doing that to Paper Space objects or Model Space objects in a viewport? You can change the lineweight of all lines, arcs, and polylines in a viewport using viewport overrides. If you modify the lineweight or width of an object then it would have that lineweight or width in every viewport.

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

    Default Re: Any wanna take a look on this?

    Quote Originally Posted by Tom Beauford View Post
    You can only set width to polylines, not lines or arcs. Are you doing that to Paper Space objects or Model Space objects in a viewport? You can change the lineweight of all lines, arcs, and polylines in a viewport using viewport overrides. If you modify the lineweight or width of an object then it would have that lineweight or width in every viewport.
    i forgot to tell that i have this lisp without the "foreach" and it works perfekt..
    it ask if i wanna make the lines and arcs to poly lines.. i say yes and it do the rest by makeing all with 1.4 in line width.

    all the lines in layer"GRUPPEOMRÅDE" is placed in paperspace.

    Why i wanna have this lisp is because we need to see the lines like the printouts when we are placeing symbols in paperspace.

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    1

    Default Re: Any wanna take a look on this?

    Try this, per Opie's solution.


    Code:
    (Defun c:SGM (/ s ss sn i)
      (setvar "peditaccept" 1)
      (foreach lay (layoutlist)
        (setvar 'ctab lay)
        (if	(setq s	 (ssadd)
    	      ss (ssget	"_x"
    			'((0 . "ARC,LINE,LWPOLYLINE") (8 . "GRUPPEOMRÅDE"))
    		 )
    	)
          (progn
    	(repeat	(setq i (sslength ss))
    	  (setq sn (ssname ss (setq i (1- i))))
    	  (if (not (eq (cdr (assoc 100 (reverse (entget sn))))
    		       "AcDb3dPolyline"
    		   )
    	      )
    	    (ssadd sn s)
    	  )
    	)
    	(if (> (sslength s) 0)
    	  (command "_.pedit" "_m" s "" "w" 1.4 "")	    
    	)
    	(princ "\n .... ")
          )
        )					; end foreach
        (princ "\n Couldn't find any 2D polyline !!")
      )
      (princ)
    )
    R.K. McSwain | CAD Panacea |

  6. #6
    Member
    Join Date
    2015-04
    Posts
    4
    Login to Give a bone
    0

    Default Re: Any wanna take a look on this?

    Quote Originally Posted by rkmcswain View Post
    Try this, per Opie's solution.


    Code:
    (Defun c:SGM (/ s ss sn i)
      (setvar "peditaccept" 1)
      (foreach lay (layoutlist)
        (setvar 'ctab lay)
        (if	(setq s	 (ssadd)
    	      ss (ssget	"_x"
    			'((0 . "ARC,LINE,LWPOLYLINE") (8 . "GRUPPEOMRÅDE"))
    		 )
    	)
          (progn
    	(repeat	(setq i (sslength ss))
    	  (setq sn (ssname ss (setq i (1- i))))
    	  (if (not (eq (cdr (assoc 100 (reverse (entget sn))))
    		       "AcDb3dPolyline"
    		   )
    	      )
    	    (ssadd sn s)
    	  )
    	)
    	(if (> (sslength s) 0)
    	  (command "_.pedit" "_m" s "" "w" 1.4 "")	    
    	)
    	(princ "\n .... ")
          )
        )					; end foreach
        (princ "\n Couldn't find any 2D polyline !!")
      )
      (princ)
    )
    Dosn´t work.

    Stop at 2nd. layout and say invalid window specification.

    This works find but as you see it dosn´t have the "FOREACH" that i want. we have up to 300 layers in each dwg that need this done
    (Defun c:SGM (/ s ss sn i)
    (if (setq s (ssadd)
    ss (ssget "_x" '((0 . "ARC,LINE,LWPOLYLINE") (8 . "GRUPPEOMRÅDE")))
    )
    (progn
    (repeat (setq i (sslength ss))
    (setq sn (ssname ss (setq i (1- i))))
    (if (not (eq (cdr (assoc 100 (reverse (entget sn))))
    "AcDb3dPolyline"
    )
    )
    (ssadd sn s)
    )
    )
    (if (> (sslength s) 0)
    (command "_.pedit" "_m" s "" "w" 1.4 "")
    )
    (princ "\n .... ")
    (princ (strcat "Number of Polylines changed : "
    " < "
    (itoa (sslength s))
    " > "
    )
    )
    )
    (princ "\n Couldn't find any 2D polyline !!")
    )
    (princ)
    )

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: Any wanna take a look on this?

    Well, it does work, in certain situations, because it works just fine here on my sample drawing.

    Can you post a sample drawing of yours?
    R.K. McSwain | CAD Panacea |

  8. #8
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    1

    Default Re: Any wanna take a look on this?

    Give this a shot.

    Code:
    (Defun c:SGM (/ s ss sn i)
      (setvar "peditaccept" 1)
      (foreach lay (layoutlist)
        (setvar 'ctab lay)
        (setq s  (ssadd)
    	  ss (ssget "_x"
    		    (list
    		      (cons 0 "ARC,LINE,LWPOLYLINE")
    		      (cons 8 "GRUPPEOMRÅDE")
    		      (cons 410
    			    (if	(eq 1 (getvar 'CVPORT))
    			      (getvar 'CTAB)
    			      "Model"
    			    )
    		      )
    		    )
    	     )
        )
        (if	ss
          (progn
    	(repeat	(setq i (sslength ss))
    	  (setq sn (ssname ss (setq i (1- i))))
    	  (if (not (eq (cdr (assoc 100 (reverse (entget sn))))
    		       "AcDb3dPolyline"
    		   )
    	      )
    	    (ssadd sn s)
    	  )
    	)
    	(if (> (sslength s) 0)
    	  (command "_.pedit" "_m" s "" "w" 1.4 "")
    	)
    	(princ "\n .... ")
          )
        )					; end foreach
        (princ "\n Couldn't find any 2D polyline !!")
      )
      (princ)
    )
    R.K. McSwain | CAD Panacea |

  9. #9
    Member
    Join Date
    2015-04
    Posts
    4
    Login to Give a bone
    0

    Default Re: Any wanna take a look on this?

    Works like a charm...

    Great job thanks!

Similar Threads

  1. Wanna be an architect
    By hlamyint in forum 3ds Max - General
    Replies: 2
    Last Post: 2010-08-30, 02:46 PM
  2. I don't wanna see these lines
    By d.dragov157022 in forum Revit Architecture - General
    Replies: 4
    Last Post: 2008-03-06, 03:55 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
  •