turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Close

Visual LISP, AutoLISP and General Customization

- Autodesk Community
- >
- AutoCAD Customization
- >
- Visual LISP, AutoLISP and General Customization
- >
- Heel problems

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

48 Views, 5 Replies

10-08-2005 07:37 AM

Could some one please look at this snippet of code an advise me on what

I did wrong. When I create the truss with a 12:12 pitch it draws the

heel correctly, but if it is any other pitch, ie 6:12, it put the point

RPT8 to high. I have indicated the area of concern with arrows below.

TIA

(setvar "OSMODE" 1)

(setq LP (getpoint "\nPick working point at left side of truss: "))

(setq RP (getpoint LP "\nPick working point at right side of truss: "))

(setvar "OSMODE" 0)

;;; Calculation of points for truss

(setq TSPAN (distance LP RP))

(setq HSPAN (/ TSPAN 2.0))

-->(setq SD1 (list 0 0))

-->(setq SD2 (polar SD1 UP RISE))

-->(setq SD3 (polar SD2 RT 12.0))

-->(setq SDA1 (angle SD2 SD1))

-->(setq SDA2 (angle SD1 SD3))

-->(setq ANG (abs (- SDA2 SDA1)))

(setq LOHD (- LOH FASTHK))

(setq ROHD (- ROH FASTHK))

(setq HYP (abs (/ TCHDS (sin ANG))))

(setq LPD (polar LP DN (ris LOHD)))

(setq RPD (polar RP DN (ris ROHD)))

(setq PT1 (polar LPD LT LOHD))

(setq PT5 (polar RPD RT ROHD))

(setq PT2 (polar PT1 UP HYP))

(setq PT4 (polar PT5 UP HYP))

(setq PT2_3 (polar PT2 UP (ris (+ HSPAN LOHD))))

(setq PT3 (polar PT2_3 RT (+ HSPAN LOHD)))

(setq PT1_3 (polar PT1 RT (+ LOHD HSPAN)))

(setq PT6 (polar PT1_3 UP (ris (+ LOHD HSPAN))))

(setq LPU (polar LP UP BCHDS))

(setq RPU (polar RP UP BCHDS))

(setq PT7 (inters LPU RPU PT1 PT6 nil))

(setq PT8 (inters LPU RPU PT5 PT6 nil))

; Calculation of points for Rafter

(setq HYPR (abs (/ RFT (sin ANG))))

(setq LPR (polar LP RT WTHKL))

(setq LPDN (polar LP DN (/ WTHKL (tan ang))))

(setq RFTLPD (polar LPDN DN (ris LOHD)))

(setq RPT1 (polar RFTLPD LT LOHD))

(setq RPT2 (polar RPT1 UP HYPR))

(setq RPT2_3 (polar RPT2 UP (ris (+ HSPAN LOHD))))

(setq RPT3 (polar RPT2_3 RT (+ HSPAN LOHD)))

(setq RPT1_3 (polar RPT1 RT (+ LOHD HSPAN)))

(setq RPT4 (polar RPT1_3 UP (ris (+ LOHD HSPAN))))

(setq RDIST (distance PT3 RPT3))

; Draw lines of Truss - top chords

(if (= WTRUSS 1)

(progn

(command "_pline" PT1 PT2 PT3 PT4 PT5 PT6 PT1 "")

(setq TOPCHD (entlast))

);progn

);if

; Draw lines of Rafter

(if (= RFTR 1)

(progn

(command "_pline" LP LPDN RPT1 RPT2 RPT3 RPT4 LPR LP "")

); progn

);if

;;; Move Top Chord of Truss Equivalent to Raftr and creates heel

(if (= equiv 1)

(progn

(command "move" TOPCHD "" (list 0 0) (polar (list 0 0) up RDIST))

(command "_pline" LP LPU RPU RP LP "")

(setq HPT7 (polar LP UP RDIST))

(setq HPT9 (polar LPU RT 3.5))

--> (setq HPT8 (polar HPT7 ANG (/ 3.5 (cos ANG))))

(command "_pline" LPU HPT7 HPT8 HPT9 LPU "");Draws the Heel

(setq Heel (entlast))

(command ".mirror" heel "" pt3 pt1_3 "n")

);progn

(command "_pline" LP RP PT8 PT7 LP ""); Draws the standard bottom chord

);if)

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

I did wrong. When I create the truss with a 12:12 pitch it draws the

heel correctly, but if it is any other pitch, ie 6:12, it put the point

RPT8 to high. I have indicated the area of concern with arrows below.

TIA

(setvar "OSMODE" 1)

(setq LP (getpoint "\nPick working point at left side of truss: "))

(setq RP (getpoint LP "\nPick working point at right side of truss: "))

(setvar "OSMODE" 0)

;;; Calculation of points for truss

(setq TSPAN (distance LP RP))

(setq HSPAN (/ TSPAN 2.0))

-->(setq SD1 (list 0 0))

-->(setq SD2 (polar SD1 UP RISE))

-->(setq SD3 (polar SD2 RT 12.0))

-->(setq SDA1 (angle SD2 SD1))

-->(setq SDA2 (angle SD1 SD3))

-->(setq ANG (abs (- SDA2 SDA1)))

(setq LOHD (- LOH FASTHK))

(setq ROHD (- ROH FASTHK))

(setq HYP (abs (/ TCHDS (sin ANG))))

(setq LPD (polar LP DN (ris LOHD)))

(setq RPD (polar RP DN (ris ROHD)))

(setq PT1 (polar LPD LT LOHD))

(setq PT5 (polar RPD RT ROHD))

(setq PT2 (polar PT1 UP HYP))

(setq PT4 (polar PT5 UP HYP))

(setq PT2_3 (polar PT2 UP (ris (+ HSPAN LOHD))))

(setq PT3 (polar PT2_3 RT (+ HSPAN LOHD)))

(setq PT1_3 (polar PT1 RT (+ LOHD HSPAN)))

(setq PT6 (polar PT1_3 UP (ris (+ LOHD HSPAN))))

(setq LPU (polar LP UP BCHDS))

(setq RPU (polar RP UP BCHDS))

(setq PT7 (inters LPU RPU PT1 PT6 nil))

(setq PT8 (inters LPU RPU PT5 PT6 nil))

; Calculation of points for Rafter

(setq HYPR (abs (/ RFT (sin ANG))))

(setq LPR (polar LP RT WTHKL))

(setq LPDN (polar LP DN (/ WTHKL (tan ang))))

(setq RFTLPD (polar LPDN DN (ris LOHD)))

(setq RPT1 (polar RFTLPD LT LOHD))

(setq RPT2 (polar RPT1 UP HYPR))

(setq RPT2_3 (polar RPT2 UP (ris (+ HSPAN LOHD))))

(setq RPT3 (polar RPT2_3 RT (+ HSPAN LOHD)))

(setq RPT1_3 (polar RPT1 RT (+ LOHD HSPAN)))

(setq RPT4 (polar RPT1_3 UP (ris (+ LOHD HSPAN))))

(setq RDIST (distance PT3 RPT3))

; Draw lines of Truss - top chords

(if (= WTRUSS 1)

(progn

(command "_pline" PT1 PT2 PT3 PT4 PT5 PT6 PT1 "")

(setq TOPCHD (entlast))

);progn

);if

; Draw lines of Rafter

(if (= RFTR 1)

(progn

(command "_pline" LP LPDN RPT1 RPT2 RPT3 RPT4 LPR LP "")

); progn

);if

;;; Move Top Chord of Truss Equivalent to Raftr and creates heel

(if (= equiv 1)

(progn

(command "move" TOPCHD "" (list 0 0) (polar (list 0 0) up RDIST))

(command "_pline" LP LPU RPU RP LP "")

(setq HPT7 (polar LP UP RDIST))

(setq HPT9 (polar LPU RT 3.5))

--> (setq HPT8 (polar HPT7 ANG (/ 3.5 (cos ANG))))

(command "_pline" LPU HPT7 HPT8 HPT9 LPU "");Draws the Heel

(setq Heel (entlast))

(command ".mirror" heel "" pt3 pt1_3 "n")

);progn

(command "_pline" LP RP PT8 PT7 LP ""); Draws the standard bottom chord

);if)

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-08-2005 02:29 PM in reply to:
*Nick Haury

Nick,

It might help to attach a small drawing, with the

expected result..and label the points. Also show

approx. where the PT8 is located when incorrect.

Bob

It might help to attach a small drawing, with the

expected result..and label the points. Also show

approx. where the PT8 is located when incorrect.

Bob

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-08-2005 03:46 PM in reply to:
*Nick Haury

I can do this, here ya go!

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

ECCAD wrote:

> Nick,

> It might help to attach a small drawing, with the

> expected result..and label the points. Also show

> approx. where the PT8 is located when incorrect.

>

> Bob

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

ECCAD wrote:

> Nick,

> It might help to attach a small drawing, with the

> expected result..and label the points. Also show

> approx. where the PT8 is located when incorrect.

>

> Bob

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-08-2005 08:44 PM in reply to:
*Nick Haury

I found it, I found it, GOD is so good.

The problem was in the definition of the 'ANG' setq. Why I defined that

I'll never know, I think it had to do with have a triangle upside down.

Well, any way, I started out by defining the roof pitch, asking for

user input for the roof pitch, then I next did this, I defined a

starting point. (setq sd1 (list 0 0)), I then next input the pitch, so

if the user input, lets say 6.0 for the pitch the the next setq went

like this, (setq sd2 (polar sd1 up pitch)), up is defined as

(setq up (* pi (/ 90.0 180.0))) and remember the pitch was set to 6.0.

Next it took sd2 and moved it right the run

(setq sd3 (polar sd2 rt 12.0)). Then it did some funky stuff, like,

(setq sda1 (angle sd2 sd1) and (setq sda2 (angle sda1 sda3)). Now the

next item is what I use for setting the roof pitch,

(setq ANG (abs (- SDA2 SDA1))), which doesnt make any sence to me why I

did this, but it didn't work. Like I said I think it has to do with

inverting the geometrical triangle. This is why I figure this, sda1 is

the angle dn in radians, right? So it would be 4.71239 in radians which

is the same as (setq dn (* pi (/ 270.0 180.0)) = (setq sda1 (angle sd2

sd1), but the part which I should have used is (setq sda2 (angle sd1

sd3)) = 0.463648 radians which just happens to be 26 Degs 33 min 54 sec

= 26.57 degs or a 6in pitch. This is what I used to corect the statment

and get the heel to draw correctly. But anywho, this statment, (setq

ANG (abs (- SDA2 SDA1))) returns this, SDA1 = 4.71239 radians and

SDA2 = 0.463648 radians, so 0.463648 minus 4.71239 equals -4.248742

radians whaich is a -243.4349848 degs?????????? So what could this be?

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

ECCAD wrote:

> Nick,

> It might help to attach a small drawing, with the

> expected result..and label the points. Also show

> approx. where the PT8 is located when incorrect.

>

> Bob

The problem was in the definition of the 'ANG' setq. Why I defined that

I'll never know, I think it had to do with have a triangle upside down.

Well, any way, I started out by defining the roof pitch, asking for

user input for the roof pitch

starting point. (setq sd1 (list 0 0)), I then next input the pitch, so

if the user input, lets say 6.0 for the pitch the the next setq went

like this, (setq sd2 (polar sd1 up pitch)), up is defined as

(setq up (* pi (/ 90.0 180.0))) and remember the pitch was set to 6.0.

Next it took sd2 and moved it right the run

(setq sd3 (polar sd2 rt 12.0)). Then it did some funky stuff, like,

(setq sda1 (angle sd2 sd1) and (setq sda2 (angle sda1 sda3)). Now the

next item is what I use for setting the roof pitch,

(setq ANG (abs (- SDA2 SDA1))), which doesnt make any sence to me why I

did this, but it didn't work. Like I said I think it has to do with

inverting the geometrical triangle. This is why I figure this, sda1 is

the angle dn in radians, right? So it would be 4.71239 in radians which

is the same as (setq dn (* pi (/ 270.0 180.0)) = (setq sda1 (angle sd2

sd1), but the part which I should have used is (setq sda2 (angle sd1

sd3)) = 0.463648 radians which just happens to be 26 Degs 33 min 54 sec

= 26.57 degs or a 6in pitch. This is what I used to corect the statment

and get the heel to draw correctly. But anywho, this statment, (setq

ANG (abs (- SDA2 SDA1))) returns this, SDA1 = 4.71239 radians and

SDA2 = 0.463648 radians, so 0.463648 minus 4.71239 equals -4.248742

radians whaich is a -243.4349848 degs?????????? So what could this be?

--

Nick Haury

AEC Design Services

4959 W. 5th Street

Greeley, CO 80634

Office and Fax (970)356-5511

Cell (970)313-3162

aecdesign@truevine.net

ftp site: http://www.truevine.net/~aecdesign@truevine.net

ECCAD wrote:

> Nick,

> It might help to attach a small drawing, with the

> expected result..and label the points. Also show

> approx. where the PT8 is located when incorrect.

>

> Bob

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-10-2005 06:17 AM in reply to:
*Nick Haury

Nick,

I knew you could find it.

>>>(setq ANG (abs (- SDA2 SDA1))) returns this, SDA1 = 4.71239 radians and

SDA2 = 0.463648 radians, so 0.463648 minus 4.71239 equals -4.248742

radians whaich is a -243.4349848 degs??????????<<<

Actually, no. the 'abs' part in there, sets the ANG to

an (absolute) value, always is positive that way.

Bob

Bob

I knew you could find it.

>>>(setq ANG (abs (- SDA2 SDA1))) returns this, SDA1 = 4.71239 radians and

SDA2 = 0.463648 radians, so 0.463648 minus 4.71239 equals -4.248742

radians whaich is a -243.4349848 degs??????????<<<

Actually, no. the 'abs' part in there, sets the ANG to

an (absolute) value, always is positive that way.

Bob

Bob

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-11-2005 09:06 AM in reply to:
*Nick Haury

Nick,

Try this for the HPT8 point.

;;; (setq HPT8 (polar HPT7 sda2 (/ 3.5 (cos sda2))))

(setq PT1_U (list (+ (car PT1) 0.0)(+ (cadr PT1) RDIST)))

(setq PT6_U (list (+ (car PT6) 0.0)(+ (cadr PT6) RDIST)))

(setq PT7_U (list (+ (car PT7) 0.0)(+ (cadr PT7) 100.0)))

(setq HPT8 (inters PT1_U PT6_U PT7 PT7_U nil))

Bob

Try this for the HPT8 point.

;;; (setq HPT8 (polar HPT7 sda2 (/ 3.5 (cos sda2))))

(setq PT1_U (list (+ (car PT1) 0.0)(+ (cadr PT1) RDIST)))

(setq PT6_U (list (+ (car PT6) 0.0)(+ (cadr PT6) RDIST)))

(setq PT7_U (list (+ (car PT7) 0.0)(+ (cadr PT7) 100.0)))

(setq HPT8 (inters PT1_U PT6_U PT7 PT7_U nil))

Bob

Search This Board

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Post to the Community

Have questions about Autodesk products? Ask the community.

The Knowledge Network

Access a broad range of knowledge to help get the most out of your products and services.

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.

Maintenance Subscription Resources

Upgrading to a 2015 product? Make sure to check these out 1st!

- Privacy | Legal Notices & Trademarks | Report Noncompliance | Site map | © Copyright 2014 Autodesk Inc. All rights reserved

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ for more information.