Author Topic: if no choice the surface ,Can't continue until chose the face  (Read 5764 times)

0 Members and 1 Guest are viewing this topic.

andy_lee

  • Newt
  • Posts: 147
Dear all

We know (vl-cmdf "_.UCS" "_F") is returns T , and  (command "_.UCS" "_F") is returns nil

I want know
when I use  (command "_.UCS" "_F") or   (vl-cmdf "_.UCS" "_F"),   if  no choice the surface ,Can't continue  until  chose the face.
Is there any way to do it?
andy.
Best regards.

77077

  • Guest
Re: if no choice the surface ,Can't continue until chose the face
« Reply #1 on: August 02, 2015, 06:25:00 AM »
I think no possible

mianbaoche

  • Guest
Re: if no choice the surface ,Can't continue until chose the face
« Reply #2 on: August 02, 2015, 07:29:13 AM »
andy_lee Try!

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt()
  2.   (setq org (getvar "UCSORG"))
  3.   (vl-cmdf "_.UCS" "_F")
  4.   (while (null (equal 0 (distance (getvar "UCSORG" ) org) 1e-6))(vl-cmdf ""))
  5.  )

« Last Edit: August 02, 2015, 02:29:56 PM by mianbaoche »

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #3 on: August 03, 2015, 04:24:03 AM »
andy_lee Try!

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt()
  2.   (setq org (getvar "UCSORG"))
  3.   (vl-cmdf "_.UCS" "_F")
  4.   (while (null (equal 0 (distance (getvar "UCSORG" ) org) 1e-6))(vl-cmdf ""))
  5.  )

Hi mianbaoche
The trouble is still exist .  Can use Dxf or vla to solve?
andy.
Best regards.

mianbaoche

  • Guest
Re: if no choice the surface ,Can't continue until chose the face
« Reply #4 on: August 03, 2015, 04:34:41 AM »
You can tell what the results,continue  until  to do?

To speak clearly and easily understand

Can use Dxf or vla to solve?Not very understanding。

77077

  • Guest
Re: if no choice the surface ,Can't continue until chose the face
« Reply #5 on: August 03, 2015, 05:15:44 AM »
I said that is not possible.
OP's describe is very clearly.  if this is  possible, Lee , roy ,ron  has given the answer.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #6 on: August 03, 2015, 06:05:56 AM »
Ok, Thanks guys.  I abandoned. :oops:
andy.
Best regards.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: if no choice the surface ,Can't continue until chose the face
« Reply #7 on: August 04, 2015, 12:48:29 AM »
andy_lee,
What is your goal ?

Do you require to set the UCS to a solid face without selecting the face ??

Do you have difficulty selecting/choosing the face ?

Are you unable to select the face for some reason ?

If you don't select the face, how do you imagine the UCS can be set ??

More explicit details of your requirements may help to find an answer.


//-----------------
added:
I have been watching this thread and noticed a lot of nasty behaviour which required deleted posts.
Please be a little nicer to each other ... we are ALL here to learn, not to play silly mean games.


« Last Edit: August 04, 2015, 01:21:23 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #8 on: August 04, 2015, 01:50:56 AM »
Hi Kerry
What happened?

sorry for my english .
Code - Auto/Visual Lisp: [Select]
  1.   (setq cmde (getvar 'cmdecho))
  2.   (setvar 'cmdecho 1)
  3.   (if e
  4.     (progn
  5.       (command "_.copybase" "_non" p e "" "")
  6.       (entdel e)
  7.       (prompt "\nPick face of 3D solid (edge which is parallel to Trapezoid top edge), then adjust UCS further more (Xflip, Yflip, next face if wrong picked) and then press ENTER to accept...")
  8.       (command "_.UCS" "_F")
  9.  

;;if  no choice the surface ,Can't continue

Code - Auto/Visual Lisp: [Select]
  1.       (while (< 0 (getvar 'cmdactive)) (command "\\"))
  2.       (setq p (getpoint "\nPick or specify top center point to place Trapezoid : "))
  3.       (command "_.pasteclip" "_non" p)
  4.       (command "_.rotate" (entlast) "" "_non" p "\\")
  5.     )
  6.   )
  7.   (command "_.UCS" "_P")
  8.   (*error* nil)
  9.  

The complete code from here:
Thanks marko.
http://www.theswamp.org/index.php?topic=49800.msg550233#msg550233
« Last Edit: August 04, 2015, 01:55:40 AM by andy_lee »
andy.
Best regards.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: if no choice the surface ,Can't continue until chose the face
« Reply #9 on: August 04, 2015, 01:56:52 AM »


So, you have resolved the problem ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #10 on: August 04, 2015, 01:58:47 AM »


So, you have resolved the problem ??

No solution .
andy.
Best regards.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: if no choice the surface ,Can't continue until chose the face
« Reply #11 on: August 04, 2015, 02:01:00 AM »

Please read my post again.

What is your actual problem  ???
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #12 on: August 04, 2015, 02:04:29 AM »

Please read my post again.

What is your actual problem  ???

 :cry: :cry: :cry:
http://www.theswamp.org/index.php?topic=49875.msg550678#msg550678

code...
I wrote explanatory notes here.
code...
andy.
Best regards.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: if no choice the surface ,Can't continue until chose the face
« Reply #13 on: August 04, 2015, 02:09:00 AM »

Please read my post again.

What is your actual problem  ???

 :cry: :cry: :cry:
http://www.theswamp.org/index.php?topic=49875.msg550678#msg550678

code...
I wrote explanatory notes here.
code...

What good is posting 'code' as an explanation for a problem if the code doesn't work.

I want you to read my post and answer the questions I asked.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #14 on: August 04, 2015, 02:48:41 AM »

Please read my post again.

What is your actual problem  ???

 :cry: :cry: :cry:
http://www.theswamp.org/index.php?topic=49875.msg550678#msg550678

code...
I wrote explanatory notes here.
code...

What good is posting 'code' as an explanation for a problem if the code doesn't work.

I want you to read my post and answer the questions I asked.

Hi kerry
if use entsel function can like this :
(while (progn (null (setq e (entsel "\nPlease choose ."))))) ;; if no choose anything , can't continue or exit

as the same ,I need
 
when (command "_.UCS" "_F") , if no choose any face of 3d solid  ,can't run behind code

 (setq p (getpoint "\nPick or specify top center point to place Trapezoid : "))
 (command "_.pasteclip" "_non" p)
 (command "_.rotate" (entlast) "" "_non" p "\\")


andy.
Best regards.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: if no choice the surface ,Can't continue until chose the face
« Reply #15 on: August 04, 2015, 03:10:15 AM »
Have you tried to modify my code as suggested by member like this :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:Test ( / *error* dtr ac ab p sl a b c d e p ucsf cmde org )
  2.   ;;    Author : Tharwat Al Shoufi                      ;;
  3.   ;; Draw Trapezoid with angle 55 on the two sides      ;;
  4.   ;; -------------------------------------------------- ;;
  5.   (defun *error* ( msg )
  6.     (if cmde (setvar 'cmdecho cmde))
  7.     (if (not (eq (getvar 'worlducs) 1)) (command "_.UCS" "_P"))
  8.     (if ucsf (command "_.UCS" "_P"))
  9.     (if msg (prompt msg))
  10.     (princ)
  11.   )
  12.   (defun dtr (a) (* pi (/ a 180.0)))
  13.   (if (not *traplen*)
  14.     (setq *traplen* 10.0)
  15.   )
  16.   (if (not *traphgt*)
  17.     (setq *traphgt* 4.0)
  18.   )
  19.   (if (not (eq (getvar 'worlducs) 1))
  20.     (progn
  21.       (command "_.UCS" "_W")
  22.       (setq ucsf t)
  23.     )
  24.   )
  25.   (if (and (setq *traplen* (cond ((getdist (strcat "\n Specify Length of Trapezoid < " (rtos *traplen* 2 2) " > :")))
  26.                                  (*traplen*)
  27.                            )
  28.            )
  29.            (setq *traphgt* (cond ((getdist (strcat "\n Specify Height of Trapezoid < " (rtos *traphgt* 2 2) " > :")))
  30.                                  (*traphgt*)
  31.                            )
  32.            )
  33.            (setq ac (/ *traphgt* (sin (dtr 55.)))
  34.                  ab (* ac (cos (dtr 55.)))
  35.            )
  36.            (if (>= (setq sl (- *traplen* (+ ab ab))) 0.)
  37.              (setq p '(0.0 0.0 0.0))
  38.              (progn (alert "Length of Trapezoid is too small !!") nil)
  39.            )
  40.       )
  41.     (progn (setq a (polar p pi (/ sl 2.))
  42.                  b (polar a (dtr 235.) ac)
  43.                  c (polar b 0. *traplen*)
  44.                  d (polar c (dtr 125.) ac)
  45.                  e (entmakex
  46.                      (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1))
  47.                              (mapcar '(lambda (pt) (cons 10 (list (car pt) (cadr pt)))) (list a b c d))
  48.                      )
  49.                    )
  50.            )
  51.     )
  52.   )
  53.   (setq cmde (getvar 'cmdecho))
  54.   (setq org (getvar 'ucsorg))
  55.   (setvar 'cmdecho 1)
  56.   (if e
  57.     (progn
  58.       (command "_.copybase" "_non" p e "" "")
  59.       (entdel e)
  60.       (prompt "\nPick face of 3D solid (edge which is parallel to Trapezoid top edge), then adjust UCS further more (Xflip, Yflip, next face if wrong picked) and then press ENTER to accept...")
  61.       (command "_.UCS" "_F")
  62.       (while (< 0 (getvar 'cmdactive)) (command "\\"))
  63.       (while (equal 0.0 (distance (getvar 'ucsorg) org) 1e-6)
  64.         (command "_.UCS" "_F")
  65.         (while (< 0 (getvar 'cmdactive)) (command "\\"))
  66.       )
  67.       (setq p (getpoint "\nPick or specify top center point to place Trapezoid : "))
  68.       (command "_.pasteclip" "_non" p)
  69.       (command "_.rotate" (entlast) "" "_non" p "\\")
  70.     )
  71.   )
  72.   (command "_.UCS" "_P")
  73.   (*error* nil)
  74. )
  75.  

It should be working well all until you click on valid face of 3d solid...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: if no choice the surface ,Can't continue until chose the face
« Reply #16 on: August 04, 2015, 03:16:45 AM »
Why don't you want to pick a solid face to set the UCS.

Do you want to preset the UCS before you run the program ???


Do you know the best way to select the Face ??

The 3DSolid face data is not available to Lisp or VLisp so attempting to use entsel or entget is useless.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

andy_lee

  • Newt
  • Posts: 147
Re: if no choice the surface ,Can't continue until chose the face
« Reply #17 on: August 04, 2015, 03:51:05 AM »
Have you tried to modify my code as suggested by member like this :

It should be working well all until you click on valid face of 3d solid...

Thanks again ,marko   very cool .  ^-^

But I test maibaoche's code , It's not ok !   :-(
andy.
Best regards.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: if no choice the surface ,Can't continue until chose the face
« Reply #18 on: August 04, 2015, 05:39:36 AM »
Comparing the ucsorg to determine if the user has selected a face is problematic if the same face is selected twice.