Jump to content

Multiple Layouts paper space select similar lisp


himal

Recommended Posts

hi, Please help me, I am finding command or lisp for multiple layout paper space select similar poly lines. Please see the attached ,  Thank you.

1.pdf

Link to comment
Share on other sites

Thank you.

This drawing viewport already done. I need to change paper space continuation line type change only. 

Link to comment
Share on other sites

If the lines are in the same location in every layout then yes could be done. Are they part of a  title block then can edit the block BEDIT and all done. 

 

If they are the only objects on a layer then yes even easier. Change to layout get all plines on layer then use CHPROP all done, repeat for all layouts.

 

Need a dwg to look at. 

Link to comment
Share on other sites

The only lines in any of the layouts are Match Lines with "Arrow Contin" blocks on each end.

Modifying the lines will not move the blocks.

 

What exactly are you trying to do?

Link to comment
Share on other sites

i want change that line type only. now it line type center i want to change it phantom line type and line type scale 25

Link to comment
Share on other sites

Do you have the SSX command? Available through the express tools I believe. Run the command, select an example line that you want to change, and I believe all similar lines, even in other layouts, will be selected. Then use the properties palette to change the linetype. It may also pick up lines in model space, but you could just deselect them manually.

Link to comment
Share on other sites

(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(sslength ss)

puts 173 lwpolylines in Paperspace on Layer 0 color 6 with linetype CENTER2 into selection set ss for you to modify however you wish.

Link to comment
Share on other sites

Try this

 

(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vlax-put obj 'Linetype "Phantom")
(vlax-put obj 'LinetypeScale 0.25)
)

 

  • Like 1
Link to comment
Share on other sites

Give this a try

 

(defun C:foo (/ lyt c tab SS)
  (setq lyt (getvar 'ctab))
  (setq c 0)
  (setvar 'cmdecho 0)
  (if (not (tblsearch "ltype" "PHANTOM"))
    (vl-cmdf "._linetype" "_load" "PHANTOM" "default.lin" "")   ; Might have to change to "Acadiso.lin" for AutoCAD
  )
  (foreach tab (layoutlist)
    (setvar 'ctab tab)
    (setq SS (ssget "X" '((0 . "*POLYLINE") (6 . "Center2") (62 . 6) (cons 410 (getvar "ctab")))))
    (vl-cmdf "_.Chprop" SS "" "LT" "PHANTOM" "")
    (setq c (+(sslength ss) c))
  )
  (setvar 'ctab lyt)
  (setvar 'cmdecho 1)
  (prompt (strcat "\n"(itoa c) " Poylines Changed"))
  (Princ)
)

 

steps though each tab and Selects polylines that are color magenta &  center2 line type then uses change properties to line type phantom

goes back the the tab you had selected before you ran the command and prompt you to how many poylines where changed.

 

--edit modified @BIGAL to check if phantom line is already loaded. i think thats the error your getting himal

This works A LOT FASTER and cleaner.

 

(defun C:foo (/ SS obj e)
  (vl-load-com)
  (if (not (tblsearch "ltype" "PHANTOM"))
    (vl-cmdf "._linetype" "_load" "PHANTOM" "default.lin" "")   ; Might have to change to "Acadiso.lin" for AutoCAD
  )
  (if (setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
    (progn
      (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS)))
        (setq obj (vlax-ename->vla-object e))
        (vlax-put-property obj 'Linetype "PHANTOM")
        (vlax-put-property obj 'LinetypeScale 0.25)
      )
      (prompt (strcat "\n" (itoa (sslength SS)) " Polylines Changed"))
    )
    (prompt "\nNo Polyelins Change")
  )
  (princ)
)

 

Edited by mhupp
Link to comment
Share on other sites

On 5/24/2021 at 4:57 PM, tombu said:

(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(sslength ss)

puts 173 lwpolylines in Paperspace on Layer 0 color 6 with linetype CENTER2 into selection set ss for you to modify however you wish.

 

I don't know if Bricscad is different but this didn't work for me I got an error

171 entities are not in the current space.

Only changed the two that where on the current tab even tho the rest where in the selections set. I had to step thought each tab to change them like above.

Link to comment
Share on other sites

3 hours ago, himal said:

like this massage coming 

"; error: bad argument type: lselsetp nil"  

you need to reload PHANTOM line type firstly then run BIGAL code.

 

  • Thanks 1
Link to comment
Share on other sites

Added loading PHANTOM linetype to BIGAL's code.

(or(tblsearch "ltype" "PHANTOM")(command-s "._linetype" "_load" "PHANTOM" "acad.lin" ""))
(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vlax-put obj 'Linetype "Phantom")
(vlax-put obj 'LinetypeScale 0.25)
)

 

Link to comment
Share on other sites

Thank You Its work now (reload the line type )💯💯

On 5/25/2021 at 9:56 AM, BIGAL said:

Try this

 



(setq ss (ssget "_X" '((0 . "LWPOLYLINE") (67 . 1) (8 . "0") (62 . 6) (6 . "CENTER2"))))
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vlax-put obj 'Linetype "Phantom")
(vlax-put obj 'LinetypeScale 0.25)
)

 

 

Edited by himal
Link to comment
Share on other sites

10 hours ago, mostafa badran said:

you need to reload PHANTOM line type firstly then run BIGAL code.

 

Thank you now its work.

Link to comment
Share on other sites

Thanks guys for adding linetype check.

 

; error : Automation Error 80200025; [IAcadLWPolyline] Error accessing [LINETYPE] property. ErrIndex=0;
Invalid Symbol Table name

 

Acad= Acad.lin Acadiso.lin

Bricscad= Default.lin

 

Use (vlax-product-key) to work out which software. A simple request becomes complicated.

 

(if(tblsearch "ltype" "PHANTOM")
(princ)
(progn 
(if (wcmatch  (vlax-product-key) "*BricsCAD*")
(setq linetypename "Phantom" filename "Default.lin")
(setq linetypename "Phantom" filename "Acad.lin")
)
(vl-catch-all-apply
            'vla-load (list (vla-get-Linetypes (vla-get-activedocument (vlax-get-acad-object)) LineTypeName   FileName))
)
)
)

 

 

  • Like 2
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...