Author Topic: [LISP] Normal vector in given point on surface  (Read 258 times)

0 Members and 1 Guest are viewing this topic.

WhoseThatLispIsOnTheCAD

  • Mosquito
  • Posts: 2
[LISP] Normal vector in given point on surface
« on: October 12, 2021, 06:01:33 AM »
Hello everyone.
Im working on some script whitch be able to wrap a plane onto a curved shaped surface. Something similar to "shrikwrap" modifier in Blender. I try to simulate the natural effect of a lath bending on bottle neck. If the direction of bending a board is collinear with the main curvature its tend to twist.
This effect is shown here:
https://drive.google.com/file/d/16FR6H5uFYlVO7usGb3SpZHULhjBFtJCh/view?usp=sharing
The steps of the program looks like:
1. Find a startPoint - whitch is an itersection point of a given ray and the surface
   here i have also some problems because to find this point i generate the section via Vl-cmdf _section and looks  for an intersection point with a given ray (red color line on the image). Sometimes created section shape is made of lines, polylines, 3dpolylines or splines. Espacialy when splines are being created the intersection points can not be find because of a devation - the splines doesnt lays on a section plane (diferrences about 0,0001) 
2. From the startPoint program looks for edge points (width of lath P1 and P2)
3. The lath is being divided into small parts (points along dthe edges) and tests the distance relation beetwen them.
4. From P1 and P2 scripts is looking for points Px1 and Px2 on a surface whitch have the same distance relations as the oryginal ones. Px1 becomes P1 and so on for given number of iteration...
to find this point im using get_border_on_surface whitch collects a sort of point list spreaded around the given point  P1 with the same distance
https://www.youtube.com/watch?v=Ys2yoAecjio   - here is sample testing...
The program works very slowly and the problems accurs when the curvature fades out of the horizon - surface became prependicular to the curent UCSSo i need to find to find normal vector in a point P1 to generate multiple sections around this normal axis
https://drive.google.com/file/d/1LAbW8A-S93FDITzycgWjNiOCmWEXdE2J/view
IS any way to get point list of a intersected face by ray as a subsurface element via vlisp??
ps. Im a newbie with lacks of knowlege, but here is probably one and only place i can get some hints and where i can be enligthen. You are my Hope - the most proffecional cad forum on worldWide... :-)

didier

  • Newt
  • Posts: 37
  • expatriť
Re: [LISP] Normal vector in given point on surface
« Reply #1 on: October 12, 2021, 07:06:04 AM »
Bonjour WhoseThatLispIsOnTheCAD

What you are asking for is programmable if what you call surface are face3d.
But since you are a beginner (it is you who say it) I think it is not a good idea to treat this kind of concern.
The ancient elders said "think big but start small".

Amicalement
eternal beginner ...
my english is not fluent ...

WhoseThatLispIsOnTheCAD

  • Mosquito
  • Posts: 2
Re: [LISP] Normal vector in given point on surface
« Reply #2 on: October 12, 2021, 08:32:04 AM »
Thanks for Your interest didier.
As a subsurface i mean the planar part (polygon) of entire surface, like is in an edit mesh mode in other 3d modelling softwares. If i could get vertices from that face (3 planar points) thats would solve the problem... Solids and surfaces (dxf code) are a mystery for me, total magic witch them i can not deal with :(. In dynamic UCS mode autocad recognize that normal vector immediately according to the cursor position on the screen. Im wondering how to intercept that....

didier

  • Newt
  • Posts: 37
  • expatriť
Re: [LISP] Normal vector in given point on surface
« Reply #3 on: October 12, 2021, 11:33:43 AM »
Bonjour

to transform surfaces into 3D faces you just have to decompose them
then it is a calculation of vectors and normal for each point of the polygon to project on the faces.
As I told you it is not simple for a beginner.
Amicalement
eternal beginner ...
my english is not fluent ...

d2010

  • Bull Frog
  • Posts: 210
Re: [LISP] Normal vector in given point on surface
« Reply #4 on: October 17, 2021, 05:57:12 AM »
You need integrate mathematicallyLisp  inside VLISP.?
You develop, here,  the  list-of-all-Steps as you need.
If you can not write a LIST-of-Steps, then you cannot finish this post.
Code: [Select]
01).You upload a sample Drawing.dwg (as old-version Acad2010 or Acad2018)
02).User select one point outside from surface3d.
03).-- You fill here --
....
31)....
Hello everyone.
Im working on some script whitch be able to wrap a plane onto a curved shaped surface. Something similar to "shrikwrap" modifier in Blender. I try to simulate the natural effect of a lath bending on bottle neck. If the direction of bending a board is collinear with the main curvature its tend to twist.