Jump to content

Recommended Posts

Posted

Hello.

Can someone give me a clue how to get coordinates of points in some current ucs

converted to wcs to fall to exactly the same place but with different coords(of course in wcs)?

I've tried with (trans pnt 1 0 ) but they fall not in the same place as in ucs...

Posted

Usually (trans pnt 1 0) works.

 

How are you determining the 'pnt value ? Some entity points are store only in WCS, so that ( trans ) is not required.

ie All 3DFACE points, polyline mesh points, 3dpolyling points, some dimensions points

 

-David

Posted

i get the points by selecting them...

here's complete lisp

 

;;; Calculating heights of points on slope by selecting 3 points
;;; first two points are for determining longitudinal slope and third is for
;;; latitudinal slope

(defun c:PHOS  (/ 1_pnt 2_pnt 3_pnt h_ppx h_ppy 2_pnt_t 3_pnt_t 1_pnt_u 2_pnt_u 3_pnt_u)
 (setvar "cmdecho" 0)
 (setq osm(getvar 'OSMODE))
 (setvar 'OSMODE 
 (princ"\nSelect 3 points with known height for determining slope...\n
 ...starting point,ending point and point on the left side relative to first two")
 (setq 1_pnt(getpoint)
2_pnt(getpoint)
3_pnt(getpoint)
h nil
h_ppx(/(-(caddr 2_pnt)(caddr 1_pnt))
	(sqrt(+(expt(-(car 2_pnt)(car 1_pnt))2)(expt(-(cadr 2_pnt)(cadr 1_pnt))2))))
1_pnt_u (reverse(cons 0.0 (cdr(reverse 1_pnt))))
2_pnt_u (reverse(cons 0.0 (cdr(reverse 2_pnt))))
3_pnt_u (reverse(cons 0.0 (cdr(reverse 3_pnt))))
)
 (setvar 'OSMODE 0)
 (command "ucs" "3p" 1_pnt_u 2_pnt_u "")
 (setq 1_pnt_t(trans 1_pnt 0 1)
2_pnt_t(trans 2_pnt 0 1)
3_pnt_t(trans 3_pnt 0 1)
h_ppy(/(-(caddr 3_pnt_t)(+(* h_ppx (car 3_pnt_t))(caddr 1_pnt)))(cadr 3_pnt_t))
)
 (setvar 'OSMODE 
 (while(setq pnt(getpoint"\nPick point for calculating height"))
   (setq h(+ (caddr 1_pnt)(*(car pnt)h_ppx)(*(cadr pnt)h_ppy)))
   (command "text" "j" "bl" (trans pnt 1 0) "" "" (rtos h 2 3))
   ;(princ "\n")
   ;(princ (rtos h 2 3))
   )
 (command "ucs" "")
 (setvar 'OSMODE osm)
 ) 

(princ
 "\nCalculating point heights on slope...
 Copyright © by TOMISLAV VARGEK...Osijek,Croatia...\n    ...Type PHOS to start..."
 ) 

(defun *error*	(msg)
 (command "ucs" "")
 (setvar 'OSMODE osm)
 (princ)
 ) 

 

 

notice the line with command "text"...that's where i need to place the text to wcs

Posted

(getpoint) function takes point data from current UCS... Maybe this statement can help you determine where is your mistake...

Posted

yes i know that and everything works well, just not placing the text..do you think i should use entsel instead of getpoint?

Posted

Try change to this:

(command "text" "j" "bl" pnt "" "" (rtos h 2 3))

Posted

yes i know i can do that but then i get differently rotated text for every next slope calculation and i'm trying to avoid that...that's why i tried via trans...maybe there's a way to get text always rotated in same direction but i don't know how?

Posted

Try :

 

 (while (setq pnt (getpoint"\nPick point for calculating height"))
   (setq h(+ (caddr 1_pnt)(*(car pnt)h_ppx)(*(cadr pnt)h_ppy)))
   (setq pnt (trans pnt 1 0))
   (command "ucs" "w")
   (command "text" "j" "bl" pnt "" "" (rtos h 2 3))
   (command "ucs" "p")
   )

Posted

Trans function doesn't effect the rotation of text. So if you want the (entlast) text to have a right rotation you have to entmod it's rotation.

Posted

Thanx Marko (majstore :thumbsup:) that solved it...i was trying something similar but could newer get the right combination what to turn and when :roll:

and thanx 7o7 and David for the input...

Posted

You may also want to look into (entmake) ing the text. This gives you full control of the text entity as well as bypassing the text command input idiosyncraties. But you will either need to address the current object creation modes or specify the values explicitly.


;*** = Required Group

(entmake (list (cons 0 "TEXT")              ;***
              (cons 1 "")                  ;***
              (cons 6 "BYLAYER")
              (cons 7 "STANDARD")          ;***
              (cons 8 "0")
              (cons 10 (list 0.0 0.0 0.0)) ;***
              (cons 11 (list 0.0 0.0 0.0)) ;***
              (cons 39 0.0)
              (cons 40 1.0)                ;***
              (cons 41 1.0)
              (cons 50 0.0)
              (cons 51 0.0)
              (cons 62 256)
              (cons 71 0)
              (cons 72 0)
              (cons 73 0)
              (cons 210 (list 0.0 0.0 1.0))))

 

-David

Posted

yes, entmaking text gives you more options for formatting and leaves no wondering like direction of 0 angle and direction of rotation and default text size(i didn't know that word 'idiosyncraties' for those gremlins;)) :?...

i just needed to solve orienting text, and this and the rest of "fine-tuning" comes with further development and enhancements of this lisp

cheers

Posted

These sysvars should head you in the 'right' direction ;

 

UCSORG        0.00,0.00,0.00                       (read only)
UCSXDIR       1.00,0.00,0.00                       (read only)
UCSYDIR       0.00,1.00,0.00                       (read only)

 

Command: ucs

Origin/ZAxis/3point/OBject/View/X/Y/Z/Prev/Restore/Save/Del/?/<World>: 3p

Origin point <0,0,0>: 2,3,3

Point on positive portion of the X-axis <3.00,3.00,3.00>: 6,5,5

Point on positive-Y portion of the UCS XY plane <1.55,3.89,3.00>:

Command: setvar
Variable name or ?: ?

Variable(s) to list <*>: uc*

UCSFOLLOW     0
UCSICON       1
UCSNAME       ""                                   (read only)
UCSORG        6.00,9.00,9.00                       (read only)
UCSXDIR       0.82,0.41,0.41                       (read only)
UCSYDIR       -0.45,0.89,0.00                      (read only)

-David

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...