Surface triangle minimum lenght

Surface triangle minimum lenght

zozzer0206
Observer Observer
1,179 Views
8 Replies
Message 1 of 9

Surface triangle minimum lenght

zozzer0206
Observer
Observer

Hello, I encunterd a problem where autocad connects triangles where i dont need them. I could manuali re align them, but it is a very monoton task to do. I was looking for some help on forums and found an AutoLISP code for setting maximum triangle lenght. I'm wandering if there is any way to use minimum lenght insted of maximum. I tried changing maximim to minimum in the code, but AutoCAD dont recognise minimum. Can anyone help me with this? Code form user Hippie013 

;Get your existing surface
(setq surf-obj (vlax-ename->vla-object (car (entsel "\nSelect Surface Object:"))))

;Get the Surface Definition Properties
(setq defprop (vlax-get-property surf-obj 'DefinitionProperties))

;Set the Maximum Triangle Length
(setq tml (getreal "\nEnter Maximum Triangle Length:"))

(vlax-put-property defprop 'MaximumTriangleLength tml)

;Use Maximum Triangle Length
(vlax-put-property defprop 'UseMaximumTriangleLength :vlax-true)

;Rebuild your Surface
(vlax-invoke-method surf-obj 'Rebuild)

 

0 Likes
1,180 Views
8 Replies
Replies (8)
Message 2 of 9

hippe013
Advisor
Advisor

The following image shows the available properties of the IAeccTinSurfaceDefinitionProperties object. 

hippe013_0-1712856449028.png

 

Setting the maximum triangle length will prevent the surface from adding a line longer than specified so if that isn't doing what you are hoping it did then maybe you would benefit from adding an outer border to your surface. 

 

Message 3 of 9

zozzer0206
Observer
Observer

Thank you! I see but i think none ofe these would solve my problem. I present you an image so maybe my problem is more clear. So e have this river bed data, and ato cad somtimes connects wrong triangles. I could do it manual by swicshing adges on each and evry flasli connected tryangle, but on this scal that would cost me hours or even days of work. So I was thinking by sathing a minimum triangle lenght  a should be able to filter out most of the falsli connected triangles. But it seems ther is no way to mak minimum triangle lenght. I was thinking maybe adjusting the angel wich can triangels be formed would solve this issue as well. Please let me know if you have any ide what could I do to make this faster/easyer. (Btw nice to see you found this after i saw your code from 9 years ago, I hope you are doing well)

 

0 Likes
Message 4 of 9

hippe013
Advisor
Advisor

Can you point out what triangles you feel aren't good? At a glance, and without knowing the details of the data it appears to me that it looks just fine. It appears that it is closely spaced data (left & right) and further spaced data (up & down stream). Between adding boundaries, adding breaklines, and setting maximum lengths you can direct the build operations to build the surface how you see fit.   

 

(It is always fun to see my old code! 😁

0 Likes
Message 5 of 9

zozzer0206
Observer
Observer

So I have these triangles (pic number 1) but i would need the lines to conect more like on (pic number 2)

0 Likes
Message 6 of 9

hippe013
Advisor
Advisor

Your data is really close to each other left & right and further apart up & down. You could weed the data (left & right) and remove some points to create a more uniform grid of points, or you could add breaklines in the up & down direction to prevent the triangles from interpolating left and right, however it appears with that many points that you'd have to add a lot of breaklines. Filtering your data to be more uniform might be your easiest and quickest option. I can see how that would be very tedious to manually swap all of those triangles.

0 Likes
Message 7 of 9

zozzer0206
Observer
Observer

Yes, it would be a good option to filter the data, but i don't want to make that compromise. I would go for more presision and deatail. I heard abut making an algorithm or somthing to add a vla properti or two to make minimum lenght and angle witch to points can or can't conect to. 

0 Likes
Message 8 of 9

hippe013
Advisor
Advisor

Well. The other thing that you could do is project each cross section point onto a best fit line that represents that cross section. This would prevent the interpolation from crossing itself. 

 

hippe013_0-1712939926667.png

I doubt that it would diminish the integrity of the data. It would just clean it up a bit.   

0 Likes
Message 9 of 9

zozzer0206
Observer
Observer

Thanks for the help. I will try this a hope it solves this issue..

0 Likes