Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mult. LISPS in one drawing, do the variables have to be unique?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
chadmart
411 Views, 6 Replies

Mult. LISPS in one drawing, do the variables have to be unique?

Hello,

 

I've been working on (with the help of some of you fine people!) several LISP routines, and I was finding some odd things happening when I was running those LISP routines. I was wondering, since many of these contain variables with the same names, is there any reason why those variables would have to be unique? In other words, if I am using my coneline LISP that has the variable dist1, and then I am also using my krail LISP that has the same variable, do those variables have to have different names? I would think not, as each LISP routine defines the variable and it's value, but I am getting some strange effects and I wanted to just get confirmation one way or the other.

 

Thanks.

6 REPLIES 6
Message 2 of 7
p_mcknight
in reply to: chadmart

After calling your defun c:xxx make sure you are including your variables in ( / xx xxx xxxx xxxxx etc.) so that they are processed as local variables.  If you do not do this, then the variables and values are stored in memory and can cause issues with other functions, depending on how you code them.

Message 3 of 7
chadmart
in reply to: p_mcknight

Ok. So that doesn't seem to be my problem then, as all the routines I am talking about do that. Thanks for the quick response!
Message 4 of 7
p_mcknight
in reply to: chadmart

If you can give some examples of the odd behavior or share some of your lsp files maybe we can zero in on a cause.

Message 5 of 7
chadmart
in reply to: chadmart

Well, the arraypath objects in the attached drawing were created with the attached LISP routine. The top line is a solid polyline from beginning to end, with the array spacing constant throughout. These blocks represent cones on a road, and at times the spacing may have to vary, therefore the easy approach is to explode the PL and run the lisp three times... the problem is that the cones within the arc aren't aligned to the arc. The first cone is set to an angle of zero, but it should be aligned to the beginning point of the arc. I've had some instances of it just placing one block and creating an array, but not having multiple objects in that array, though the path is identified and the distance between objects is less than the length of the path.

Message 6 of 7
p_mcknight
in reply to: chadmart

Without digging into it too much...

To start look at the if close to end part

(setq inspt endpt
       ang   (* (/ (angle (vlax-curve-getPointAtDist path (- len 0.001)) inspt) pi 180)))
      )

 

Note that your pi and 180 are not separated by a paranthesis.  This is giving you an innacurate value.  Check that and let me know if it still needs more work.

Message 7 of 7
chadmart
in reply to: p_mcknight

That worked. Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost