Jump to content

Recommended Posts

Posted

I'm not sure what to put in. It should be a replacement of the vlax-3d-point?

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    22

  • Lt Dan's legs

    17

  • Lee Mac

    12

  • REID7800

    8

Top Posters In This Topic

Posted Images

Posted
I'm not sure what to put in. It should be a replacement of the vlax-3d-point?

 

 

 

           (setq d2 (getdist p1 "\nSpecify box width: ")) ;; modified by Reid b.
          (setq d3 (getdist p1 "\nSpecify box length: ")) ;;by Reid b.

Posted

Also,

 

(distance p1 p2)

d2

___________________________________

(distance p1 p3)

d3

___________________________________

(angle (trans p1 1 0) (trans p2 1 0))

Additional Input req'd

Posted

alright I'm going crazy trying to figure out the 3d input thing. I keep getting an error saying it's a bad arguement 2d/3d input.

 

I hate that I'm taking up your time. I wish there was a class here for this stuff

Posted

; error: bad argument type: 2D/3D point: nil

Posted
; error: bad argument type: 2D/3D point: nil

 

Ahh, I wasn't thinking about rotation. How are you determining that?

 

If you don't have to change the rotation, just change:

 

(angle (trans p1 1 0) (trans p2 1 0))

to

0.

Posted
Ahh, I wasn't thinking about rotation. How are you determining that?

 

If you don't have to change the rotation, just change:

 

(angle (trans p1 1 0) (trans p2 1 0))

to

0.

 

I WAS CHANGING THE ROTATION BY

(vlax-3d-point (trans p1 1 0))
       blockname
       1.
       1.
       1.
       [color=red]0.[/color] ;;<---- THIS

Posted

Try this. It should also store your distance variables. UNTESTED

 

(defun c:COMP1 (/ blockname p1)
 ;; Alan J. Thompson, 05.12.10
 (vl-load-com)
 (setq blockname "1compartment")
 (if (and (or (tblsearch "block" blockname)
              (findfile (strcat blockname ".dwg"))
              (alert (strcat blockname " cannot be found!"))
          )
          (setq p1 (getpoint "\nSpecify block insertion point: "))
          (setq *COMP1:WD*
                 (cond ((getdist (strcat "\nSpecify box width"
                                         (if *COMP1:WD*
                                           (strcat " <" (vl-princ-to-string *COMP1:WD*) ">: ")
                                           ": "
                                         )
                                 )
                        )
                       )
                       (*COMP1:WD*)
                 )
          )
          (setq *COMP1:LG*
                 (cond ((getdist (strcat "\nSpecify box length"
                                         (if *COMP1:LG*
                                           (strcat " <" (vl-princ-to-string *COMP1:LG*) ">: ")
                                           ": "
                                         )
                                 )
                        )
                       )
                       (*COMP1:LG*)
                 )
          )
     )
   ((lambda (block)
      (foreach x (vlax-invoke block 'GetDynamicBlockProperties)
        (cond
          ;; width
          ((eq (vla-get-propertyname x) "DISTANCE")
           (vla-put-value
             x
             (cond
               ((>= 0.125 (/ *COMP1:WD* 0.125)) 0.125)
               ((< 0.125 (setq num (/ *COMP1:WD* 0.125))) (* 0.125 (fix num)))
               (0.125)
             )
           )
          )
          ;; length
          ((eq (vla-get-propertyname x) "DISTANCE1")
           (vla-put-value
             x
             (cond
               ((>= 0.125 (/ *COMP1:LG* 0.125)) 0.125)
               ((< 0.125 (setq num (/ *COMP1:LG* 0.125))) (* 0.125 (fix num)))
               (0.125)
             )
           )
          )
        )
      )
      (vl-catch-all-apply (function (lambda () (vla-explode block) (vla-delete block))))
    )
     (vla-insertblock
       (if
         (or (eq acmodelspace
                 (vla-get-activespace
                   (cond (*AcadDoc*)
                         ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
                   )
                 )
             )
             (eq :vlax-true (vla-get-mspace *AcadDoc*))
         )
          (vla-get-modelspace *AcadDoc*)
          (vla-get-paperspace *AcadDoc*)
       )
       (vlax-3d-point (trans p1 1 0))
       blockname
       1.
       1.
       1.
       0.
     )
   )
 )
 (princ)
)

Posted

By the way, are you using the Visual LISP Editor to edit the LISP? Why not just use the deb u g g e r (can't believe it filters that) in that to determine the location of your error - it will save you from 'driving yourself crazy'...

Posted
Try this. It should also store your distance variables. UNTESTED

 

Exactly what I wanted! Thank you

 

No more questions on this thread from me

Posted
By the way, are you using the Visual LISP Editor to edit the LISP? Why not just use the deb u g g e r (can't believe it filters that) in that to determine the location of your error - it will save you from 'driving yourself crazy'...

Are you talking about the Debug pulldown? I can't run/test the routine since I don't have the block.:| All I can do is make sure my parens match. Would be nice if it checked syntax though.:glare:

 

Exactly what I wanted! Thank you

 

No more questions on this thread from me

You're welcome. :) Enjoy. I guess you'll be combining my checks. :lol:

Posted
By the way, are you using the Visual LISP Editor to edit the LISP? Why not just use the deb u g g e r (can't believe it filters that) in that to determine the location of your error - it will save you from 'driving yourself crazy'...

 

To be honest I never tried any of the tools in the Visual LISP editor. I was worried it was going to mess things up.

Posted

Point me in the right direction. I'll use all the advice you guys give me.

Posted
Are you talking about the Debug pulldown? I can't run/test the routine since I don't have the block.:| All I can do is make sure my parens match. Would be nice if it checked syntax though.:glare:

 

Sorry Alan, I was aiming my point at Reid - when he said he was going crazy trying to work out the error.

Posted

Example of how to use the VLIDE's debugging capabilities...

 

Make sure this is ticked, so that a break point will be set:

 

Step1.png

 

Run the code, if there is an error, a break point will be set at the expression that throws the error.

 

Check for the last break source using this:

 

Step2.png

 

For everything else, have a good read of this.

 

Lee

Posted
Sorry Alan, I was aiming my point at Reid - when he said he was going crazy trying to work out the error.

 

Ahh, OK. I wasn't sure, so I thought I'd respond to it anyway. :)

Posted

Thank you! You've been extremely helpful. Both of you have

Posted
Thank you! You've been extremely helpful. Both of you have

 

 

You're welcome. Enjoy. :)

Posted

You're very welcome - I hope you can identify the errors in your programs easier now :)

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...