cutsheets or matchlines auto populate

cutsheets or matchlines auto populate

djharo71
Explorer Explorer
1,606 Views
7 Replies
Message 1 of 8

cutsheets or matchlines auto populate

djharo71
Explorer
Explorer

I have created a script that does zoom to sheets and set the sheet as needed now i am looking for some help with a script that will populae the cutsheets or matchsheets in paperspace for the sheets that are sitting next to the set sheet in model space. I have created blocks called "MATCHLINE TOP",  "MATCHLINE BOTTOM",  "MATCHLINE RIGHT",  "MATCHLINE LEFT". I am trying to get them to populate correctly where they are needed and if not needed then not to be placed. and help would be greatly appreciated

0 Likes
1,607 Views
7 Replies
Replies (7)
Message 2 of 8

paullimapa
Mentor
Mentor

Try this attached code Cutsheets.lsp

It only works if each of the borders overlap each other and not cross over which your original dwg had 04 crossing over 06. But once I moved 04 on top of 06 then the code works.

Your original dwg with 04 crossing over 06

paullimapa_0-1717006333621.png

Attached revised dwg with 04 overlapping 06

paullimapa_1-1717006386162.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 8

djharo71
Explorer
Explorer
You are awesome thank you for all the help.
I need to write one more that will total up all the material for some fiber work if you would be interested my boss will pay you very well. If you are not interested but know a program who would be please let me know. We are doing a lot of fiber networking for internet services and have to have accurate totals for each project. It takes along time to do by hand and there is way to much human error, so we are wanting to automate it to eliminate those problem. If you would like to discuss further feel free to email me at [email protected]
0 Likes
Message 4 of 8

paullimapa
Mentor
Mentor

Again post this as a new topic with sample drawings that contain objects that represent the fiber material. Someone may take this challenge up as well....cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 8

komondormrex
Mentor
Mentor

and another one

(defun c:set_match_lines (/ sheets_sset sheets_list llc ruc sheet_center sheet_half_dims point_1 point_2 point_3 point_4 fence_line
						 	adjacent_sset adjacent_list llc_2 ruc_2 adjacent_sheet_number match_sheet_sset 
						 )
	(setvar 'ctab "model")
	(if (if (setq sheets_sset (ssget "_x" '((0 . "insert") (66 . 1))))
			(setq sheets_list (vl-remove-if-not '(lambda (insert) (= "SHEETS" (vla-get-effectivename (vlax-ename->vla-object insert))))
												 (vl-remove-if 'listp (mapcar 'cadr (ssnamex sheets_sset)))
							  )
			)
		)
		(foreach sheet sheets_list
			(vla-getboundingbox (vlax-ename->vla-object sheet) 'llc 'ruc)
			(setq llc (vlax-safearray->list llc)
				  ruc (vlax-safearray->list ruc)
				  sheet_center (mapcar '* '(0.5 0.5) (mapcar '+ llc ruc))
				  sheet_half_dims (mapcar '* '(0.5 0.5) (mapcar 'abs (mapcar '- ruc llc)))
				  point_1 (mapcar '+ (list (* -0.05 (car sheet_half_dims)) (* -0.05 (cadr sheet_half_dims))) llc)
				  point_2 (mapcar '+ (list (* -0.05 (car sheet_half_dims)) (* 0.05 (cadr sheet_half_dims))) (list (car llc) (cadr ruc)))
				  point_3 (mapcar '+ (list (* 0.05 (car sheet_half_dims)) (* 0.05 (cadr sheet_half_dims))) ruc)
				  point_4 (mapcar '+ (list (* 0.05 (car sheet_half_dims)) (* -0.05 (cadr sheet_half_dims))) (list (car ruc) (cadr llc)))
			)
		  	(princ "\n\n=====================")
			(princ (strcat "\nAnalyzing sheet: "(getpropertyvalue sheet "sheet_number")))
		  	(princ "\n=====================")
			(foreach side '("top" "bottom" "left" "right")
				(setq fence_line (cond 
						   			((= "top" side) (list point_2 point_3)) 
						   			((= "bottom" side) (list point_1 point_4)) 
						   			((= "left" side) (list sheet_center (polar sheet_center pi (* 1.05 (car sheet_half_dims))))) 
						   			((= "right" side) (list sheet_center (polar sheet_center 0 (* 1.05 (car sheet_half_dims))))) 
								 )
				)
			  	(princ (strcat "\nMatchline " side ": "))
				(cond 
					((and
				      	 (setq adjacent_sset (ssget "_f" fence_line '((0 . "insert") (66 . 1))))
					 	 (setq adjacent_list (vl-remove sheet (vl-remove-if-not '(lambda (insert) (= "SHEETS" (vla-get-effectivename (vlax-ename->vla-object insert))))
					 			 			   									 (vl-remove-if 'listp (mapcar 'cadr (ssnamex adjacent_sset)))    
					 				    	 				  )
					 		    			 )
						 )
				     )
						(if (or (= "bottom" side) (= "top" side))
						 	(setq adjacent_list (vl-remove-if '(lambda (sheet) (progn (vla-getboundingbox (vlax-ename->vla-object sheet) 'llc_2 'ruc_2)
															  (or
															      (> (car llc) (car (vlax-safearray->list ruc_2)))
																  (< (car ruc) (car (vlax-safearray->list llc_2)))
																  (= (car llc) (car (vlax-safearray->list ruc_2)))
																  (= (car ruc) (car (vlax-safearray->list llc_2)))
															  )
												   )
										  	   )
											   adjacent_list
									)
												    
							)
					  	)
						(cond
						  ((null adjacent_list) (setq adjacent_sheet_number ""))  
						  ((= 1 (length adjacent_list)) (setq adjacent_sheet_number (getpropertyvalue (car adjacent_list) "sheet_number")))
						  (t (setq adjacent_sheet_number (apply 'strcat (cdr (apply 'append (mapcar '(lambda (sheet) (list "," (getpropertyvalue sheet "sheet_number"))) adjacent_list))))))
						)
					)
					( t (setq adjacent_sheet_number ""))
				)
			  	(princ adjacent_sheet_number)
				(if (and
						 (setq match_sheet_sset (ssget "_x" (list '(0 . "insert") (cons 2 (strcat (strcat "matchline " side) "," (strcat "matchline_" side))) (cons 410 (getpropertyvalue sheet "sheet_number")))))
						 (= 1 (sslength match_sheet_sset))
					)
						(setpropertyvalue (ssname match_sheet_sset 0) "nextpage" adjacent_sheet_number)
				)
			)
		)
	)
	(princ)
)
0 Likes
Message 6 of 8

bryanwork89
Community Visitor
Community Visitor

hey, so you say you created a script that does zoom to sheets and set the sheet as needed. This mean it will auto and center the sheets into paper space? If so, is this a script? 

0 Likes
Message 7 of 8

Sea-Haven
Mentor
Mentor

@bryanwork89 have a look at this. One way to make rectangs.

 

 

 

0 Likes
Message 8 of 8

bryanwork89
Community Visitor
Community Visitor

you have the lsp for this? 

 

0 Likes