Jump to content

Code posting guidelines


CADTutor

Recommended Posts

Code posting guidelines

When you are posting AutoLISP or VBA code in these forums, there are some simple guidelines you should observe in order to make life easier for you and for others.

 

Always add routines or code snippets using the Code option. This makes them easier to read within posts by making them distinct from other text. It helps those who may want to copy and paste the code. It also helps to save space because code blocks get a scroll bar beyond a certain number of lines.

 

code-post-1.png.d4f30f78f1e2328d85b9144975da9183.png

 

1. Click the Code button on the editor toolbar. That's the one with the "<>" on it. You will then see the Code modal, shown below.

 

code-post-2.png.71ce99095c142af519fd48b8f621ca6a.png

 

2. Type or paste your code into the text box.

3. Select "No Syntax Highlighting" from the drop-down.

4. Click Insert into post.

 

code-post-3.thumb.png.2e8726bd93f182f3e6bae57b4e0934a5.png

 

5. Add any instructions or additional commentary to your post.

6. Click Submit Reply (or Submit Topic if you are starting a new topic).

See the next post in this topic for the final result.

 

Please ensure that you have the right to publish code on a public forum. In most cases, the code you are publishing will be your own and it will be assumed that if no attribution is given, you are the author. However, if you are not the author, you must make this clear and where possible, give credit to the author. Any routines published here must have their header intact, including any title, instructions, author contact details, date and copyright information. If at all possible, please make sure that you have the author's permission to publish their work.

 

You may, at your discretion, claim specific copyright over your code. All authors have the right to explicitly claim copyright of their code. We recommend that if you wish to do so, you use a standard form such as Creative Commons.

 

 

 

 

  • Thanks 1
Link to comment
Share on other sites

  • CADTutor unlocked this topic
(defun C:Helix1()
(setq nr 30);segments
(setq fi (/ (* 2 PI) nr) i 0)
(setq r (getreal "Radius of helix "))
(setq p (getreal "elevation "))
(setq old (getvar "osmode"))
(command "3dpoly")
(repeat (+ nr 1) (setq x (* r (sin (* i fi)))
              y (* r (cos (* i fi)))
              z (* i (/ p nr))
      )
      (command (list x y z))
      (setq i (1+ i))
)
(command (list x y (+ z 10)));delete?
(command "")
(setvar "osmode" old)
)

Here's a LISP routine that can be used to draw a helix.

Link to comment
Share on other sites

  • CADTutor locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...