DIM Aligned to DIM Rotated + Stretch DIM group with LISP

DIM Aligned to DIM Rotated + Stretch DIM group with LISP

Lukasvop1
Advocate Advocate
530 Views
7 Replies
Message 1 of 8

DIM Aligned to DIM Rotated + Stretch DIM group with LISP

Lukasvop1
Advocate
Advocate

Hi guys, I realized I need this custom dimesion feature, can you help me with it?

 

1.Is possible replace multiple Aligned dimension with Rotated? With same position, same rotation, properties..

 

2.Is possible Stretch dimension group with LISP?

 

Thank you guys for response and help.

 

DIM Aligned to Rotated.png

 

0 Likes
Accepted solutions (1)
531 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor

Maybe a way if you do UCS OB then pick the line this sets the drafting to match that line. A Dim Hor pick points etc will draw dims square of the line etc. Then do UCS W the dim will be "AcDbRotatedDimension"

0 Likes
Message 3 of 8

komondormrex
Mentor
Mentor

should these lisps have been linked or do they go as separate codes?

0 Likes
Message 4 of 8

Lukasvop1
Advocate
Advocate

I think will be better if will be separate to 2 individual LISPs.

0 Likes
Message 5 of 8

komondormrex
Mentor
Mentor
Accepted solution

Aligned dimensions to rotated dimensions.

 

 

 

;*******************************************************************************************************************************************************************************************

;	komondormrex,	jul 2023

;*******************************************************************************************************************************************************************************************

(defun c:aligned_to_rotated (/ dim_aligned_properties dim_alligned_collection group_code group_value dim_aligned_count dim_selected_count aligned_dimension_dxf rotated_dimension_duplicate)
	(vla-startundomark (vla-get-activedocument (vlax-get-acad-object)))
	(setq dim_aligned_properties '(	StyleName AltSubUnitsFactor AltSubUnitsSuffix AltSuppressLeadingZeros AltSuppressTrailingZeros
									AltSuppressZeroFeet AltSuppressZeroInches AltTextPrefix AltTextSuffix AltTolerancePrecision AltToleranceSuppressLeadingZeros
									AltToleranceSuppressTrailingZeros AltToleranceSuppressZeroFeet AltToleranceSuppressZeroInches AltUnits AltUnitsFormat
									AltUnitsPrecision AltUnitsScale Arrowhead1Block Arrowhead1Type Arrowhead2Block Arrowhead2Type ArrowheadSize DecimalSeparator
									DimConstrDesc DimConstrExpression DimConstrForm DimConstrName DimConstrReference DimConstrValue DimensionLineColor
									DimensionLineExtend DimensionLinetype DimensionLineWeight DimLine1Suppress DimLine2Suppress DimLineInside DimTxtDirection
									EntityTransparency ExtensionLineColor ExtensionLineExtend ExtensionLineOffset ExtensionLineWeight ExtLine1Linetype ExtLine1Suppress
									ExtLine2Linetype ExtLine2Suppress ExtLineFixedLen ExtLineFixedLenSuppress Fit ForceLineInside FractionFormat HorizontalTextPosition
									Layer LinearScaleFactor Linetype LinetypeScale Lineweight Material Normal PlotStyleName PrimaryUnitsPrecision Rotation RoundDistance
									ScaleFactor SubUnitsFactor SubUnitsSuffix SuppressLeadingZeros SuppressTrailingZeros SuppressZeroFeet SuppressZeroInches TextColor
									TextFill TextFillColor TextGap TextHeight TextInside TextInsideAlign TextMovement TextOutsideAlign TextOverride TextPrefix TextRotation
									TextStyle TextSuffix ToleranceDisplay ToleranceHeightScale ToleranceJustification ToleranceLowerLimit TolerancePrecision
									ToleranceSuppressLeadingZeros ToleranceSuppressTrailingZeros ToleranceSuppressZeroFeet ToleranceSuppressZeroInches ToleranceUpperLimit
									TrueColor UnitsFormat VerticalTextPosition Visible
								  )
	)
	(if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object))) "Dim_Aligned_Collection"))))
			(vla-delete (vla-item (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object))) "Dim_Aligned_Collection"))
	)
	(setq dim_alligned_collection (vla-add (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object))) "Dim_Aligned_Collection")
		  group_code (vlax-make-safearray vlax-vbInteger '(0 . 0))
		  group_value (vlax-make-safearray vlax-vbVariant '(0 . 0))
		  dim_aligned_count 0
		  dim_selected_item 0
	)
	(vlax-safearray-put-element group_code 0 0)
	(vlax-safearray-put-element group_value 0 "dimension")
	(prompt "Select aligned dimensions to convert to rotated dimensions.")
	(vla-selectonscreen dim_alligned_collection group_code group_value)
	(if (zerop (setq dim_selected_count (vla-get-count dim_alligned_collection)))
		(princ "\nAligned dimensions were not selected.")
		(vlax-map-collection dim_alligned_collection
	   		'(lambda (every_aligned_dim)
	   				(and
	   					(= (vla-get-objectname every_aligned_dim) "AcDbAlignedDimension")
						(setq aligned_dimension_dxf (entget (vlax-vla-object->ename every_aligned_dim))
							  rotated_dimension_duplicate (vla-adddimrotated
																(vla-get-block (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object))))
																(vlax-3d-point (cdr (assoc 13 aligned_dimension_dxf)))
																(vlax-3d-point (cdr (assoc 14 aligned_dimension_dxf)))
																(vlax-3d-point (cdr (assoc 10 aligned_dimension_dxf)))
																(angle (cdr (assoc 14 aligned_dimension_dxf)) (cdr (assoc 13 aligned_dimension_dxf)))
														  )
						)
						(null (foreach property dim_aligned_properties
									(if (not (equal (vl-catch-all-apply (read (strcat "vla-get-" (vl-symbol-name property))) (list rotated_dimension_duplicate))
													(vl-catch-all-apply (read (strcat "vla-get-" (vl-symbol-name property))) (list every_aligned_dim))
											 )
										)
											(vl-catch-all-apply (read (strcat "vla-put-" (vl-symbol-name property)))
																(list rotated_dimension_duplicate
																	  (vl-catch-all-apply (read (strcat "vla-get-" (vl-symbol-name property)))
																	  					  (list every_aligned_dim)
																	  )
																)
											)
									)
							  )
						)
						(null (vla-delete every_aligned_dim))
						(setq dim_aligned_count (1+ dim_aligned_count))
						(princ (strcat "\rSelected dimensions: " (itoa dim_selected_count) ", aligned converted to rotated: " (itoa dim_aligned_count)))
	   				)
	   		 )
		)
	)
	(vla-delete (vla-item (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object))) "Dim_Aligned_Collection"))
	(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
	(princ)
)

;*******************************************************************************************************************************************************************************************

 

 

 

Message 6 of 8

Lukasvop1
Advocate
Advocate

I try it but not work..
Align_to_rotated.png

0 Likes
Message 7 of 8

komondormrex
Mentor
Mentor

already updated, check again

0 Likes
Message 8 of 8

Lukasvop1
Advocate
Advocate

Awesome, now works perfect, you are insane thank you..

0 Likes