capture for the same profile

capture for the same profile

ptdesign
Contributor Contributor
859 Views
9 Replies
Message 1 of 10

capture for the same profile

ptdesign
Contributor
Contributor

hi 

Is anybody able to support me write a Lisp for me?

This Lisp is to capture for the same profile & will highlight out if the profile is same. (pls refer attach file)

0 Likes
Replies (9)
Message 2 of 10

hak_vz
Advisor
Advisor
Accepted solution

Try this.

Run command sameAreaPoly , select starting profile and all profiles with same area will be colored red.

Depends on precise drafting but should work OK. Otherwise I don't see method that would

find what requested. Eventually one may look for pairs of intersecting dimension lines) but it

would be much complicated.

 

(defun c:sameAreaPoly ( / e eo ar ss i mo)
(setq e (car(entsel "\nSelect base profile >")))
(setq eo (vlax-ename->vla-object e))
(setq ar (vlax-get eo 'Area))
(setq ss (ssget "x" '((0 . "LWPOLYLINE"))))
(setq i -1)
(while (<(setq i (1+ i))(sslength ss))
	(setq mo (vlax-ename->vla-object (ssname ss i)))
	(cond 
		((equal ar (vlax-get mo 'Area) 1e-5)
			(command "_.chprop" (ssname ss i) "" "Color" 1 "")
		)
	)
)
(princ)
)

If this works, accept this as a solution.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 3 of 10

ptdesign
Contributor
Contributor
Accepted solution

Hi

Your lisp is working by picking one profile only,

But some profile is same but no highlight out, can I request it can select all the profile?

Then if is same then can highlight difference color.

Please advise

Thanks

Ang

0 Likes
Message 4 of 10

hak_vz
Advisor
Advisor
Accepted solution

@ptdesignIn your second sample you have mixed LWPOLYLINES amd POLYLINE object so code didn't work properly.

Now it will select all entities with same area. I'm currently at work so can not help but you can use this updated code to, step by step, filter your profiles or do what ever you need. If changes needed try to give more details and I'll work on it later today.

(defun c:sameAreaPoly ( / e eo ar ss i mo)
(setq e (car(entsel "\nSelect base profile >")))
(setq eo (vlax-ename->vla-object e))
(setq ar (vlax-get eo 'Area))
(setq ss (ssget "x" '((0 . "*POLYLINE"))))
(setq i -1)
(while (<(setq i (1+ i))(sslength ss))
	(setq mo (vlax-ename->vla-object (ssname ss i)))
	(cond 
		((equal ar (vlax-get mo 'Area) 1e-3)
			(command "_.chprop" (ssname ss i) "" "Color" 1 "")
		)
	)
)
(princ)
)

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 5 of 10

hak_vz
Advisor
Advisor
Accepted solution

___

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 6 of 10

ptdesign
Contributor
Contributor
Accepted solution

HI Hak

some profile cannot capture.(refer my attach file)

But some profile is same but no highlight out, can I request it can select all the profile?

Then if is same then can highlight difference color.

Please advise

0 Likes
Message 7 of 10

hak_vz
Advisor
Advisor
Accepted solution
((equal ar (vlax-get mo 'Area) 1e-3)

In this line you can change tolerance 1e-3 to 1e-2

Sometimes mister Murphy gets involved. You know who I'm talking about.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 8 of 10

Kent1Cooper
Consultant
Consultant
Accepted solution

Might it ever happen that you would have some with the same area, but not the same shape?

Kent1Cooper_0-1614361842639.png

The left one is 4 x 6 units, and the right one 3 x 8, so both have the same area of 24 square units minus the rounded corners.  [And of course there are an infinite number of other shapes that could have the same area.]  Since the suggestions so far compare only area, whichever of those you pick on, it will highlight both.  Should it also evaluate the shape somehow?  Even if only the width and height?

Kent Cooper, AIA
0 Likes
Message 9 of 10

ptdesign
Contributor
Contributor

HI Hak

I think your lisp is good, now I can be used.

thanks a lot,

ptdesign

Message 10 of 10

hak_vz
Advisor
Advisor
Accepted solution

Hi @ptdesign

There is probably some better method to do this test, but if this works than we should be satisfied.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes