• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

projection of points and lines on a generic plan

  • Thread starter Thread starter Betoniera
  • Start date Start date

Betoniera

Guest
hello to all
I explain my problem in the hope that the magicians of the lisp give me some suggestions.
to model the structures in the calculation programs it is necessary to import a unifilare model made of only lines made with autocad.
the difficulty lies in the fact that the lines of the beams placed for example on the ground of an irregular roof, must all stay on the same floor.
I thought of a lisp program that:
- defines the projection plan via 3 points
- project the lines or points on that plane by changing the only coordinate z (initially designed in plant).
I already have a program that projects the entities on plan z=0.
I should adapt it to prune the entities on the floor. but here there is some difficulty in defining the plan and in calculating the new quota z belonging to the plan.
There's probably something to work on.
I therefore ask whether there is already something around.
Thank you who will give me some suggestions
Hi.
 
Bye!

use "flatten" command and bring everything to z=0
That's already got it.
he wants to define a specific projection plan:
....I thought of a lisp program that:
- defines the projection plan via 3 points- project the lines or points on that plane by changing the only coordinate z (initially designed in plant).I already have a program that projects the entities on plan z=0.I should adapt it to prune the entities on the floor. but here it involves some difficulties in defining the plan and in calculating the new quota z belonging to the plan....
 
Okay, you're right.

if the z was constant would be simple, but I suppose your plans will be tilted

for constant z
1) create the plan and extract from this the coordinate z with the vla-get
2) select the elements and change to these the coordinate z with the vla-set
 
See if it works.
Code:
Proietta linee su piano inclinato
; gian paolo cattaneo - 15/01/2015

(defun c:linp ( / p1 p2 p3 lin n l pa pb )
(if (and
(setq p1 (trans (getpoint "\nselezionare 1° piano point") 1 0))
(setq p2 (trans (getpoint "\nselezionare 2° punto de piano") 1 0))
(setq p3 (trans (getpoint "\nselezionare 3° piano point") 1 0))
(princ "\nselezionare le linee da proiettare sul piano")
(setq lin (ssget '(0 . "line")))))
)
(repeat (ssslength lin)
(setq l (entget (sssname lin (setq n (1-n)))))))
(setq pa (cdr (10 l)))
(setq pb (cdr (assoc 11 l)))
(setq l (entmod (cons 10 (psp p1 p2 p3 pa))
(entmod (subst (cons 11 (psp p1 p2 p3 pb))
)
)
)

(defun psp (*p1 *p2 *p3 *p / x1 y1 z1 x2 y2 z2 x3 y3 z3 *a *b *c *pz)
(setq x1 (car *p1)
y1 (cadr *p1)
z1 (caddr *p1)
x2 (car *p2)
y2 (cadr *p2)
z2 (caddr *p2)
x3 (car *p3)
y3 (cadr *p3)
z3 (caddr *p3)
)
(setq *a (- (* (- y1 y2) (- z1 z3)) (* (- z1 z2) (- y1 y3)))
(setq *b (- (* (- z1 z2) (- x1 x3)) (* (- x1 x2) (- z1 z3))
(setq *c (- (* (- x1 x2) (- y1 y3)) (* (- y1 y2) (- x1 x3)))
(setq *pz (+ (/- (+ (*) (- (car *p) x1) *a) (* (- (cadr *p) y1) *b)) *c) z1))
(list (car *p) (cadr *p) *pz)
)
 
"See if it works."

I tried the program and it works.
Dear gp, in addition to thanking you for the time you have dedicated me, I also have to congratulate you on the simplicity and compactness of the program.
I had thought of solving this way:
- input of 3 points in the plan
- identification of the plan equation in the form a*x+b*y+c*z+d=0.
- to find the equation of the plan a system of equations of 3 incognite in matrical form (with calculation of the determinants).
- once the equation of the plan is found, the new coordinates z of the initial and final points of the lines are calculated.
- you have to regenerate the line by setting the coordinate z.
This procedure would have resulted in a code of a hundred lines.

comes gp and writes 3 lines and solves the problem.
Gp compliments, you were really cool.

Hello and thank you
 
that gp is out of the commune is now encircled :wink:

I cmq would add (and in my copy I did) these 3 lines of code at the end of the list (he always forgets... )
Code:
(setvar "cmdecho" 0)
(princ "\nproject tilted lines - use linp")
(princ "\ngian paolo cattaneo - 15/01/2015)
 
@ betoniera&cristallo

thanks :smile:

- identification of the equation of the plan.. .
the code is precisely the translation in "lispese":
calculation of the quotabe p1=(x1,y1), p2=(x2,y2), p3=(x3,y3) the three vertices of the triangle in which the p point falls, and be z1, z2, z3 the corresponding quotas.
the equation of the passing plan for the three vertices mapped in 3d is as follows:

(x-x1)a + (y-y1)b + (z-z1)c = 0

where a = (y1-y2)(z1-z3)-(z1-z2)(y1-y3)
b = (z1-z2)(x1-x3)-(x1-x2)-(z1-z3)
c = (x1-x2)(y1-y3)-y1-y2)(x1-x3)
to replace the two coordinates (xp,yp) of p and get the z:
z = ( -(xp-x1)a + (yp-y1)b / c ) + z1
normally use it for calculating points on 3dfaces.http://www.disi.unige.it/person/magillop/geomod03/labgeo1.html
 
hello to all
I explain my problem in the hope that the magicians of the lisp give me some suggestions.
to model the structures in the calculation programs it is necessary to import a unifilare model made of only lines made with autocad.
the difficulty lies in the fact that the lines of the beams placed for example on the ground of an irregular roof, must all stay on the same floor.
I thought of a lisp program that:
- defines the projection plan via 3 points
- project the lines or points on that plane by changing the only coordinate z (initially designed in plant).
I already have a program that projects the entities on plan z=0.
I should adapt it to prune the entities on the floor. but here there is some difficulty in defining the plan and in calculating the new quota z belonging to the plan.
There's probably something to work on.
I therefore ask whether there is already something around.
Thank you who will give me some suggestions
Hi.
your own problem, I found the projectgeometria command of autocad that does exactly what you are looking for
 
your own problem, I found the projectgeometria command of autocad that does exactly what you are looking forHello rand89
Thanks for the report.
Unlike our projectgeometria program, it projects entities on a region rather than on a generic plane.
but it's not a problem. Just create one and then delete it.
Moreover the command can project both according to the view and according to the z of the ucts. So it's okay.
Hi.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Staff online

Members online

Back
Top