Search the Community
Showing results for tags 'function'.
Found 10 results
Visual Lisp Utility Functions Library
JRL5735 posted a topic in AutoLISP, Visual LISP & DCLHow does everybody store their functions they use over and over? I'd like to start building a library of typical functions but am not sure how to build the document to store them for easy retrieval as needed. J. Logan
Repeating function for the mid between 2 points and writing their distance
tsotzo posted a topic in AutoLISP, Visual LISP & DCLHello, I made the following: (defun c:MC () (setq au* (getvar "aunits")) (setq osm* (getvar "osmode")) (setvar "aunits" 3) (setvar "osmode" 0) (setq pt1 (getpoint)) (setq pt2 (getpoint pt1)) (defun MdatDst () (setq dsC (/ (distance pt1 pt2) 2)) (setq angC (+ (angle pt1 pt2) (/ pi 2))) (setq ptC (polar pt1 (angle pt1 pt2) dsC)) (command "pline" pt1 pt2 "" "-text" "J" "MC" (polar ptC angC 5.5) 7.2 (angle pt1 pt2) (fix (distance pt1 pt2))) ) (MdatDst) (setvar "aunits" au*) (setvar "osmode" osm*) ) Is there a better way to apply this function to given couples of points (about 100) inside a bigger routine, than to write the same formula again and again? Thank you, Kostas
Defun Function calls with arguments, please help!!
duanuys posted a topic in AutoLISP, Visual LISP & DCLHere is my section of code that I need help on. The error VisualLISP is giving me is :Function Canceled. The builder doesn't complain, so my syntax is correct, but its just not working. I am making simple lines and changing the color to them using the "change" command with a function call. Can anyone please tell me what I am doing wrong?? Also just fyi in defun c:wellplace.. i just used the line (color po2) because i don't want to post the whole code in, everything else works fine, but breaks when it gets to that line. (defun color (col) (command "change" col "" "P" "C" "T" "255,0,0" "") ) (defun c:wellplace () (color po2) ;po2 is a "point number 2" that is calculated else in the code. ) Shouldn't it take the po2 which is a polar point, consisting of x,y,z coordinates and pass it along to the "color function"? I am doing this, because I need to do the "change" command a good 8 times, and i don't want 8 of duplicate lines of the same thing. Also if i go with not defining a function and just inputting the "change" command right into the body of my code, it works perfect, and replace 'col' with 'po2' so what gives?
Lost Function Keys
rockin_robs posted a topic in AutoCAD Beginners' AreaI am using AutoCAD for MAC 2014 for the first time and lost the function keys that appear on the left hand side of the screen. Please help me get them back Many Thanks
Tutorial: The Apostrophe and the Quote Function
Lee Mac posted a topic in AutoLISP, Visual LISP & DCLThe Apostrophe and the Quote Function I've just uploaded this tutorial to my site to provide a detailed and hopefully comprehensible explanation of the behaviour & purpose of the apostrophe & equivalent quote function in AutoLISP. Any & all feedback is very much appreciated, including anything in the tutorial that may be unclear. I hope this helps, Lee
Function keys repeating last function when pressed! ACAD2014
tmelancon posted a topic in AutoCAD Bugs, Error Messages & QuirksFor some odd reason when we use our functions keys it always repeats the previous function. If we are drawing a line and want to toggle ORTHO then change ISOPLANE, after we press F8 for ortho then press F5 to re-orient our isoplane pressing F5 actually toggles ORTHO, then when we press F8 to turn ORTHO back on it toggles F5 for re-orientation of our isoplane. So forth and so on!! So frustrating! We just switched from Autocad 2002 to Autocad 2014 and are absolutely loving it but of course are getting comfortable with our systems and are notices quirks such as this. Anybody have the same issue?
Family Annotation Symbol Shift & Rotation
magic_man1 posted a topic in Autodesk RevitHopefully I can describe this clearly, here goes.. I have a face-based family that references an annotation family. I have already been able to shift create the annotation shift function, that allows the symbol to move independent of the 3D object (moving the annotation along a wall while leaving the 3D object in place). But now I need to add the ability to rotate that annotation as well (again, independent of the 3D object). This will be used for a camera device to simulate view direction of that camera. I have been able to figure out what is needed to rotate the annotation, but when I try to apply both the shift and rotate functions it over constrains the file. Currently, I have a ref. line that creates the shift function and another that creates the rotate function (both work independently from one another). But, since one of those lines is not always parallel to the other, I cannot lock one line to the other. What I seem to need is the ability to lock an end-point of a ref line / level to the end-point of another. This should allow the shift function as well as the rotate function I need. Does anyone know of a way to do this that I may be missing? Thanks,
Is (acad) a function?
Ahankhah posted a topic in AutoLISP, Visual LISP & DCLHello CAD-lovers, I encountered a strange situation few minutes ago. I find out (acad) is a function. As a result of calling it (I think) focus brings to AutoCAD screen, while you are in Visual LISP editor. The color of function was blue, like other built-in functions. Unfortunately now, after exiting AutoCAD and returning back to it, acad returns to black, and the value of it is nil. Does any one know a way to find a clue to it?
How to define a function in AutoLISP with arbitrary arguments
Ahankhah posted a topic in AutoLISP, Visual LISP & DCLHello everyone, does anyone knows a way to define a function in AutoLISP with arbitrary arguments, same as ARX?
Logistic Map Visual Study
Lee Mac posted a topic in AutoLISP, Visual LISP & DCLAs many of you will know, I am currently studying for a degree in Mathematics, and, as part of the course, we study the dynamics of such functions as the Logistic Map. I've always been fascinated by this ostensibly simple map, which produces astoundingly complex dynamics resulting in chaos if a single parameter is varied. Quick Overview of the Logistic Map The Logistic map was originally devised as a population model, to measure the growth of a population, noting that the rate of reproduction of a species is proportional to the existing population and restricted by the available resources and competition for such resoures. We are iterating the difference equation: x[n+1] = rx[n](1-x[n]) For varying values of 0 Function maximum occurs at r/4, hence for 0 For 0 For 1 As r approaches 3, convergence to the fixed point x=r-1/r becomes increasingly slow, and a periodic point of period 2 appears when 3 From here we have a period-doubling cascade with the period doubling at a rate of approximately 4.669 (the Feigenbaum Constant). For r > 3.57 chaos emerges, with 'islands of stability' for various values of r at which periods of order 5,6,7 emerge. For r=4 the interval [0,1] is mapped to a set resembling a Cantor Set, with Hausdorff Dimension of about 0.538. A Visual Study of the Logistic Map To view the general dynamics of the Logistic Map, I have created a program where the parameter 'r' and the initial state 'x' can be varied, and the long-term behaviour of the model is displayed. To run the program: Download the attached Logistic.lsp and Logistic.dcl files. Ensure the Logistic.dcl file is located in an AutoCAD Support Path. Load the Logistic.lsp like any other LISP program (for instructions on how to do this, see here). Run the program by typing 'Logistic' at the AutoCAD command-line. I hope that I have sparked some interest in this area of mathematics and look forward to discussing the subject with the community. Enjoy! Lee logistic.lsp logistic.dcl