# Thread: Intermediate points height for profile

1. 0 Did you find this post helpful? Yes

## Re: Intermediate points height for profile

Originally Posted by aijazahmed
Hi Mr.Marko
Your code in post # 18 is working fine with (setq divRange 800.0). Same thing I need with range 800 to 1200 (for safer side I taken 1150).
because from design drawing I will get curves high and low point(chair) values like,
( 140....35....125...55...205....185...35....140) these are main point of curve and minimum distance between these main point is 1500, for safer side will consider 1600.
And in practically to maintain the curve with cable we will provide intermediate chairs (points). At least one chair must be needed between main points.

So if curve distance is,

Distance division Range
1600 / 2 = 800 (1 point) is my minimum range.
2300 / 2 = 1150 (2 points)
2400 / 2 = 1200 (2 points)
2500 / 2 = 1250 then I will go for three point 2500/3=833(3 points)
5000 / 5 = 1000 (5 points).

And no need to mark the main points it will be there already.

Thanks..
Just change : (setq divRange 800.0) to : (setq divRange 1200.0) and your request will be satisfied...

0-1200 (1000 / 1200 = 0 points (1 segment); segment length = 1000 / 1 = 1000 (800-1150))
1200 (distance between main points) / 1200 (divRange) = 1 points (2 segments) ; segment length = 1200 / 2 = 600 (800-1150)
600 is minimal value and it occur only when 2 segments are in main distance range (1200 - 1600)

1600 (distance between main points) / 1200 (divRange) = 1 points (2 segments) ; segment length = 1600 / 2 = 800 (800-1150)

in ranges from 1600 - ... 800 is minimal range of segment length

2300 (distance between main points) / 1200 (divRange) = 1 points (2 segments) ; segment length = 2300 / 2 = 1150 (800-1150)

2350 (distance between main points) / 1200 (divRange) = 1 points (2 segments) ; segment length = 2350 / 2 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 2300 - 2400)

2400 (distance between main points) / 1200 (divRange) = 2 points (3 segments) ; segment length = 2400 / 3 = 800 (800-1150)
2500 (distance between main points) / 1200 (divRange) = 2 points (3 segments) ; segment length = 2500 / 3 = 833.33 (800-1150)

4600 (distance between main points) / 1200 (divRange) = 3 points (4 segments) ; segment length = 4600 / 4 = 1150 (800-1150)

4700 (distance between main points) / 1200 (divRange) = 3 points (4 segments) ; segment length = 4700 / 4 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 2x2300=4600 - 2x2400=4800)

4800 (distance between main points) / 1200 (divRange) = 4 points (5 segments) ; segment length = 4800 / 5 = 960 (800-1150)

5000 (distance between main points) / 1200 (divRange) = 4 points (5 segments) ; segment length = 5000 / 5 = 1000 (800-1150)

6900 (distance between main points) / 1200 (divRange) = 5 points (6 segments) ; segment length = 6900 / 6 = 1150 (800-1150)

7050 (distance between main points) / 1200 (divRange) = 5 points (6 segments) ; segment length = 7050 / 6 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 3x2300=6900 - 3x2400=7200)

7200 (distance between main points) / 1200 (divRange) = 6 points (7 segments) ; segment length = 7200 / 7 = 1028.57 (800-1150)

9200 (distance between main points) / 1200 (divRange) = 7 points (8 segments) ; segment length = 9200 / 8 = 1150 (800-1150)

9400 (distance between main points) / 1200 (divRange) = 7 points (8 segments) ; segment length = 9400 / 8 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 4x2300=9200 - 4x2400=9600)

9600 (distance between main points) / 1200 (divRange) = 8 points (9 segments) ; segment length = 9600 / 9 = 1066.66 (800-1150)

11500 (distance between main points) / 1200 (divRange) = 9 points (10 segments) ; segment length = 11500 / 10 = 1150 (800-1150)

11750 (distance between main points) / 1200 (divRange) = 9 points (10 segments) ; segment length = 11750 / 10 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 5x2300=11500 - 5x2400=12000)

12000 (distance between main points) / 1200 (divRange) = 10 points (11 segments) ; segment length = 12000 / 11 = 1090.90 (800-1150)

13800 (distance between main points) / 1200 (divRange) = 11 points (12 segments) ; segment length = 13800 / 12 = 1150 (800-1150)

14100 (distance between main points) / 1200 (divRange) = 11 points (12 segments) ; segment length = 14100 / 12 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 6x2300=13800 - 6x2400=14400)

14400 (distance between main points) / 1200 (divRange) = 12 points (13 segments) ; segment length = 14400 / 13 = 1107.69 (800-1150)

16100 (distance between main points) / 1200 (divRange) = 13 points (14 segments) ; segment length = 16100 / 14 = 1150 (800-1150)

16450 (distance between main points) / 1200 (divRange) = 13 points (14 segments) ; segment length = 16450 / 14 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 7x2300=16100 - 7x2400=16800)

16800 (distance between main points) / 1200 (divRange) = 14 points (15 segments) ; segment length = 16800 / 15 = 1120 (800-1150)

17250 (distance between main points) / 1200 (divRange) = 14 points (15 segments) ; segment length = 17250 / 15 = 1150 (800-1150)

17625 (distance between main points) / 1200 (divRange) = 14 points (15 segments) ; segment length = 17625 / 15 = 1175 (800-1150)
1175 is approximately 1150 (here is gap 14x1200=16800 - 15x1200=18000) (segment gap 1120 - 1200)

18000 (distance between main points) / 1200 (divRange) = 15 points (16 segments) ; segment length = 18000 / 16 = 1125 (800-1150)

Final conclusion of this analysis is that when divRange=1200, minimal segment length is divRange/2=600, and maximal is 1200=divRange...

So maybe divRange=1400 (min. seg. = 1400/2 = 700; max. seg. = 1400)... And to be exact from what's your request (800-1150) => divRange= ((800+1150)/2)x(4/3)=1300 => (min. seg. = 1300/2 = 650 ; (975-650=325); max. seg. = 1300 ; (1300-975=325))

My calculation shows that for condition (800-1150), divRange=1300, and I suggest you to use it...

P.S. If you're unsatisfied with results, you should change your ranges condition (800-1150), and calculate divRange according to my calculation...
P.S.S. If you want to stick to unchangeable lower bound 800.0... Then ranges condition should be (800 - 2*800=1600) => divRange= ((800+1600)/2)x(4/3)=1600 => (min. seg. = 1600/2 = 800 ; [((800+1600)/2)-800=400]; max. seg. = 1600 ; [1600-((800+1600)/2)=400]
So if 800 must be respected as min. seg. - condition (800-1600), my suggestion is that divRange=1600...

P.S.S.S. As I showed if you don't have any main distances from 1200 to 1600, where seg. would be 600-800, and you want to stick and with upper bound 1200 - condition (800-1200), then my final suggestion is divRange=1200... As you said that in most distances you'll have to insert minimum 1 point - for divRange=1200 that range is (1200-2400), so in your drawing make sure that minimal distance is actually 1200 and desirable (1600-2400)... And for conclusion use divRange=1200 - that way your upper and lower bounds will be satisfied...

As for marking main points (unmarking), just comment those paragraphs with starting ;| sign and ending |; sign...

Good luck.
M.R.

2. 0 Did you find this post helpful? Yes

## Re: Intermediate points height for profile

Hi Mr.Marko

Thanks a lot mate for your best support. I know there is problem to fix divRange (800 to 1150) but we can manage this range by manual method.
So now finally I decided that we will go through the code which you posted in post #5. And lets the program ask to specify number of division.
And before this step its show the distance between main points by mark or in command line. So I can decide division number base on the distance.

sorry I change the program concept. because we cant change the range and we have design curve value with minimum points so we can save something.

Thanks...

3. 0 Did you find this post helpful? Yes

## Re: Intermediate points height for profile

Code:
```(defun fixx ( n / remi r )
(setq remi (- n (fix n)))
(if (< remi 0.5) (setq r (fix n)))
(if (>= remi 0.5) (setq r (+ (fix n) 1)))
r
)

(defun round ( n / ldig r )
(setq ldig (- n (* (fix (/ n 10.0)) 10)))
(if (< -0.5 ldig 3) (setq r (* (fix (/ n 10.0)) 10)))
(if (< 2 ldig 8) (setq r (+ (* (fix (/ n 10.0)) 10) 5)))
(if (< 7 ldig 9.5) (setq r (+ (* (fix (/ n 10.0)) 10) 10)))
r
)

(defun c:interpoints ( / osm path lowd higd dd dst k a ld ldh n nd nhig nl nlow npl p pl pthi ptlw segs ts x )

(setq osm (getvar 'osmode))
(setvar 'osmode 35)
(setq path (car (entsel "\nPick curve path along witch markers are to be placed")))
(setq ptlw (getpoint "\nPick low point"))
(initget 7)
(setq nlow (getint "\nInput low value : "))
(setq pthi (getpoint "\nPick high point"))
(initget 7)
(setq nhig (getint "\nInput high value : "))
(setq lowd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path ptlw)))
(setq higd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path pthi)))
(prompt (strcat "\nDistance between picked low and hig points is : " (rtos (- higd lowd) 2 15)))
(initget 7)
(setq segs (getint "\nSpecify number of divisions (segments) (1=>0 points;2=>1 point;3=>2 points): "))
(setq nd (- nhig nlow))
(setq x (/ (float nd) (expt segs 2)))
(setq k -1.0)
(setq n nlow)
(repeat (- segs 1)
(setq n (+ (* x (setq k (+ k 2.0))) n))
(setq nl (cons (round (fixx n)) nl))
)
(setq nl (reverse nl))
(setq k 0.0)
(if (< lowd higd)
(setq dd (/ (- higd lowd) (float segs)) dst lowd)
(setq dd (/ (- lowd higd) (float segs)) dst higd nl (reverse nl))
)
(repeat (- segs 1)
(setq p (vlax-curve-getpointatdist path (+ dst (* (setq k (1+ k)) dd))))
(setq pl (cons p pl))
)
(setq pl (reverse pl))
(setq npl (mapcar '(lambda (n p) (list n p)) nl pl))
(initget 6)
(setq ld (getdist "\nPick or input length of point marker <ENTER - 250.0> : "))
(if (null ld) (setq ld 250.0))
(initget 6)
(setq ts (getdist "\nPick or input text size <ENTER - 300.0> : "))
(if (null ts) (setq ts 300.0))
(setq ldh (/ ld 2.0))
(foreach np npl
(setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv path (vlax-curve-getparamatpoint path (cadr np)))))
(entmake (list '(0 . "LINE") (cons 62 256) '(8 . "Bar Chair - X") (cons 10 (polar (cadr np) (+ a (* pi -0.5)) ldh)) (cons 11 (polar (cadr np) (+ a (* pi 0.5)) ldh))))
(entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 62 256) '(8 . "Bar Chair - X") '(100 . "AcDbText") (cons 10 (polar (cadr np) (+ a (* pi 0.5)) ld)) (cons 40 ts) (cons 1 (itoa (car np))) (cons 50 (+ a (* pi 0.5))) '(41 . 0.7) '(51 . 0.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 0) (cons 11 (polar (cadr np) (+ a (* pi 0.5)) ld)) '(210 0.0 0.0 1.0) '(100 . "AcDbText") '(73 . 2)))
)
(setvar 'osmode osm)
(princ)
)

(defun c:ip nil (c:interpoints))```
HTH, M.R.

4. 0 Did you find this post helpful? Yes

## Re: Intermediate points height for profile

Thanks M.r Marko
Its working fine. I was need same.
Thank you so much.

Page 3 of 3 First 123

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•