#1
|
||||
|
||||
How to make this Lisp loop...
Hi,
I tried all kinds of things, but I cannot make this Lisp loop... It's basically a tool that we want to use to do a "quick fix" on short edges in models, so that the models can be imported in other CAD systems. It creates a small sphere on the picked point on a model. I'd like to be able to click another point as soon as a sphere has been created, and I tried things like prompt-variable etc., but I'm afraid that I don't fully understand the documentation on this... Anyone have a good tip on this?? Thanks! Kind regards, Jaap Code:
(in-package :JAAPS_TOOLS) (use-package :OLI) (sd-defdialog 'Repair_short_edge :dialog-title "Repair Short Edge" :variables '( (part :value-type :part :title "part") (radius :value-type :number :title "radius" :initial-value 0.1) (POINT :value-type :point-3d :title "punt" :after-input (progn (setf draaipunt (sd-vec-add POINT (gpnt3d 0 1 0))) (CREATE_WORKPLANE :new :pt_dir :origin POINT :normal :z) (line :two_points 0,-0.1 0,0.1) (ARC :CEN_RAD_ANG 0,0 0,0.1 0,-0.1 0,0.1) (turn :keep_wp :yes :keep_profile :NO :sel_part part :axis :two_pta POINT draaipunt :rotation_angle 360) (delete_3d :workplane :current) ) );point ) ) |
#2
|
|||
|
|||
Re: How to make this Lisp loop...
Quote:
Interesting idea -- Nice! The reason it doesn't loop is that you need to enclose any modeling operations in (sd-call-cmds ...) -- otherwise it's basically as if you typed them in the user input line, and then they complete and return you to the "enter command" state rather than staying in the dialog. For the looping, you can just have a line like :next-variable 'point in your code. So, if we just wrap your lines in (sd-call-cmds ...) and add the :next-variable line and a couple of other changes, we get something like this: Code:
(in-package :JAAPS_TOOLS) (use-package :OLI) (sd-defdialog 'Repair_short_edge :dialog-title "Repair Short Edge" :variables '( (part :value-type :part :title "part") (radius :value-type :distance :title "radius" :initial-value 0.1) (POINT :value-type :point-3d :title "punt" :after-input (let (draaipunt) ;; create temporary variable (setf draaipunt (sd-vec-add POINT (gpnt3d 0 1 0))) (sd-call-cmds (CREATE_WORKPLANE :new :pt_dir :origin POINT :normal :z)) (sd-call-cmds (line :two_points (gpnt2d 0 (- radius)) (gpnt2d 0 radius))) (sd-call-cmds (turn :keep_wp :yes :keep_profile :NO :sel_part part :axis :two_pta POINT draaipunt :rotation_angle (* 2 pi))) (sd-call-cmds(delete_3d :workplane :current)) ) :next-variable 'point );point ) )
Code:
(in-package :JAAPS_TOOLS) (use-package :OLI) (sd-defdialog 'Repair_short_edge :dialog-title "Repair Short Edge" :variables '( (part :value-type :part :title "part") (radius :value-type :distance :title "radius" :initial-value 0.1) (POINT :value-type :point-3d :title "punt" :after-input (progn (sd-call-cmds (CREATE_WORKPLANE :new :pt_dir :origin POINT :normal :z)) ;; draw the line so it is along the u (horizontal) axis (sd-call-cmds (line :two_points (gpnt2d (- radius) 0) (gpnt2d radius 0))) ;; the ARC command can use a ctr pnt, a radius, a start angle, and a finish angle rather than points (sd-call-cmds (arc :cen_rad_ang 0,0 radius 0 pi)) ;; turn about the u (horizontal) axis and delete WP as part of the turn operation (sd-call-cmds (turn :keep_wp :no :sel_part part :axis :u :rotation_angle (* 2 pi))) ) :next-variable 'point );point ) ) andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#3
|
||||
|
||||
Re: How to make this Lisp loop...
Hi Andy,
wow, thanks a lot!! This is most helpful! I finaly understand this awkward sd-call-cmds ;-) Kind regards, Jaap |
#4
|
|||
|
|||
Re: How to make this Lisp loop...
Jaap, thanks for posting your question, I found it to be very interesting.
Andy, great job explaining the use of SD-CALL-CMDS. I was also trying to find a solution to this issue as well by modifying and old multicopy/sharedcopy macro which performs a loop style action. I noticed the sd-call-cmds in this macro but I couldn't figure out the correct procedure to call and the recorder wasn't much help. Other than using the recorder, is there another way of finding valid commands to use with sd-call-cmds, I'm not finding anything in the IKIT documentation. Thanks, Bob
__________________
Bob Wing CAD Manager |
#5
|
|||
|
|||
Re: How to make this Lisp loop...
Quote:
Many years ago, CoCreate had an HTML command reference that shipped with each version of SolidDesigner listing the main Modeling commands (i.e. the underlying commands that are called when you click one of the CC menu buttons) and describing the parameters for each one. That was very useful, but became too much work to maintain as a separate document, so they discontinued it. Even though this reference is no longer maintained, you can at least get a list of most of the defined commands by typing (oli:sd-online-reference) into your user input line. This will insert a button in your toolbox that will show you the list of commands currently defined, and if you click one of those commands, you'll get a list of the parameters for that command (if it has any -- some don't). Unfortunately, a lot of the time you won't know what command to use in a particular situation -- so then it's back the recorder (which is also useful for knowing how to use the various parameters, too)... So, it's not the ideal situation, but it's much better than nothing! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#6
|
||||
|
||||
Re: How to make this Lisp loop...
using
Code:
(point :value-type........... ........ :next-variable 'point ) Code:
:dialog-control :sequential-loop -------------------------------------------------------- edit-start uppppssss - This have not been a good idea by me. :-( I concentrated to much on the loop itself and did not see the 2 other variables. With the loop I suggested there would be no UI at all, but also after each point clicked you would have to specify part and radius again and again. I think this is not the right way for this dialog. -- Sorry for misleading suggestion. edit-end
__________________
Last edited by Wolfgang; 05-03-2010 at 08:21 AM. Reason: misleading suggestion |
#7
|
||||
|
||||
Re: How to make this Lisp loop...
Thanks Wolfgang, I'll try that one!
Regards, Jaap |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|