Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Intermediate points height for profile

  1. #11
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    thanks opie sir for reply
    sir, really I don't know how to edit the program. But I tried to modified as you advise and when run the program it showing error "ip ; error: bad argument type: numberp: nil".
    may be I am wrong. please advise me.


    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 )
    
      (vl-load-com)
    
      (setq osm (getvar 'osmode))
      (setvar 'osmode 35)
      (initget 7)
      (setq nd (- nhig nlow):)
      (setq minRange 800) ; Assign minimum range to variable
      (setq maxRange 1150) ; Assign maximum range to variable
      (setq segs 1) ; Assign default value to segs
      (while ; Start loop
        (not ; Condition to check if the opposite of the follow criteria is true
          (and ; All of the following criteria must be true
            (> (/ nd segs) minRange) ; Does the distance fall above the minimum range
            (< (/ nd segs) maxRange) ; Does the distance fall above the maximum range
          )
        )
        (setq segs (1+ segs)) ; Now that we know the above condition was true, increment the number of segments by 1 and repeat the condition check
      )
      (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 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)
      (setq lowd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path ptlw)))
      (setq higd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path pthi)))
      (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) '(7 . "PT_PROFILE") '(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))

    Thanks....
    Last edited by Opie; 2014-04-22 at 01:40 PM. Reason: [code] tags added

  2. #12
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Couldn't you learn to use [code]Your code...[/code] Code tags... Opie explained very well what should you do...

    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 ( / minRange maxRange osm path lowd higd dd dst k a ld ldh n nd nhig nl nlow npl p pl pthi ptlw segs ts x )
    
      (vl-load-com)
    
      (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 nd (- nhig nlow))
      (setq minRange 800) ; Assign minimum range to variable
      (setq maxRange 1150) ; Assign maximum range to variable
      (setq segs 1.0) ; Assign default value to segs
      (while ; Start loop
        (not ; Condition to check if the opposite of the follow criteria is true
          (and ; All of the following criteria must be true
            (> (/ nd segs) minRange) ; Does the distance fall above the minimum range
            (< (/ nd segs) maxRange) ; Does the distance fall above the maximum range
          )
        )
        (setq segs (1+ segs)) ; Now that we know the above condition was true, increment the number of segments by 1 and repeat the condition check
      )
      (setq segs (fix segs))
      (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)
      (setq lowd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path ptlw)))
      (setq higd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path pthi)))
      (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) '(7 . "PT_PROFILE") '(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.

  3. #13
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Thanks Mr. Marko_ribar for reply
    sure i will start to learn the lisp program.
    but please check below its showing some error. when run i run the program after giving all input data its getting hang and when I press Escape its showing error. please advise me.

    Command: ip
    Pick curve path along witch markers are to be placed
    Pick low point
    Input low value : 55

    Pick high point
    Input high value : 255
    ; error: Function cancelled

    Thanks,,

  4. #14
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Difference between high value and low value must be greater than minRange variable (800) and lower than maxRange (1150), and your input was (255-55=200<800)... Try again with : Input low value : 55; Input high value : 1255 and tell me is it good - it should return the same error (1255-55=1200>1150)... Finally try with : Input low value : 55; Input high value : 1055 - it should work (1055-55=1000; 800<1000<1150)... Or try different : Input low value : 1055; Input high value : 2055 - it should work (2055-1055=1000; 800<1000<1150)...

    HTH, M.R.

  5. #15
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Having this in mind what was your request...

    Quote Originally Posted by aijazahmed View Post
    dear all
    Can anybody help me on below replied thread. I need some modification on program received from marko_ribar. The program will start with command IP and first it will ask to enter the number of divisions then select the high point, low point and to give there’s values respectively. My point is instate of asking the number of divisions it should calculate based on the distance between high point and low point. The minimum and maximum distance between inter mediate point should be (800 and 1150).
    For example:
    1) If the distance between (HP & LP) = 3000mm then number divisions will be 3.
    2) If the distance between (HP & LP) = 3500mm then number divisions will be 4.


    Any help will be more appreciate.

    Thanks.
    And having this in mind what Opie's condition intervention means - what I've just explained...

    Quote Originally Posted by marko_ribar View Post
    Difference between high value and low value must be greater than minRange variable (800) and lower than maxRange (1150), and your input was (255-55=200<800)... Try again with : Input low value : 55; Input high value : 1255 and tell me is it good - it should return the same error (1255-55=1200>1150)... Finally try with : Input low value : 55; Input high value : 1055 - it should work (1055-55=1000; 800<1000<1150)... Or try different : Input low value : 1055; Input high value : 2055 - it should work (2055-1055=1000; 800<1000<1150)...

    HTH, M.R.
    I've modified the code, but be aware that difference between high and low value must be in ranges (800<difference<1150; or 2*800=1600<difference<2*1150=2300; or 3*800=2400<difference<3*1150=3450;... and so on (segs*800<difference<segs*1150)...

    For this new explanation this code should work :

    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 ( / minRange maxRange osm path lowd higd dd dst k a ld ldh n nd nhig nl nlow npl p pl pthi ptlw segs ts x )
    
      (vl-load-com)
    
      (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 nd (- nhig nlow))
      (setq minRange 800.0) ; Assign minimum range to variable
      (setq maxRange 1150.0) ; Assign maximum range to variable
      (setq segs 1.0) ; Assign default value to segs
      (while ; Start loop
        (not ; Condition to check if the opposite of the follow criteria is true
          (< (/ nd maxRange) segs (/ nd minRange)) ; Does the distance fall above the minimum range and below the maximum range
        )
        (setq segs (1+ segs)) ; Now that we know the above condition was true, increment the number of segments by 1 and repeat the condition check
      )
      (setq segs (fix segs))
      (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)
      (setq lowd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path ptlw)))
      (setq higd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path pthi)))
      (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) '(7 . "PT_PROFILE") '(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.
    P.S. If following explained criteria isn't fulfilled (intervals for difference values), routine may and should fail...

  6. #16
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    If I may suggest what you should do to avoid endless while looping if difference between high and low value is beyond specified intervals, you should put minRange variable to 0.1 and maxRange to 800.0... This way if :

    1) 0<diff<800 there are no divisions
    2) 800<=diff<1600 there is 1 division (very much like your desired 800<diff<1150, but now no empty gap between 1150 and 2*800=1600
    3) 1600<=diff<2400 there are 2 divisions...
    ...
    n+1) 800*n<=diff<800*(n+1) there are n divisions

    With this trick you can ensure that routine won't fail in any situation, so your Low value : 55 and High value : 255 should be OK...

    And if you don't want to make low/high markers, just remove ;;; signs before and after paragraphs that are marked with comments...

    Here is newest code that should work in any case :

    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 ( / minRange maxRange osm path lowd higd dd dst k a ld ldh n nd nhig nl nlow npl p pl pthi ptlw segs ts x )
    
      (vl-load-com)
    
      (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 nd (- nhig nlow))
      (setq minRange 0.1) ; Assign minimum range to variable
      (setq maxRange 800.0) ; Assign maximum range to variable
      (setq segs 1.0) ; Assign default value to segs
      (while ; Start loop
        (not ; Condition to check if the opposite of the follow criteria is true
          (< (/ nd maxRange) segs (/ nd minRange)) ; Does the distance fall above the minimum range and below the maximum range
        )
        (setq segs (1+ segs)) ; Now that we know the above condition was true, increment the number of segments by 1 and repeat the condition check
      )
      (setq segs (fix segs))
      (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)
      (setq lowd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path ptlw)))
      (setq higd (vlax-curve-getdistatpoint path (vlax-curve-getclosestpointto path pthi)))
      (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))
    ;;; If you don't want to make start low marker with low value, mark this paragraph with starting ;| sign and ending |; sign
    ;;; ;|
      (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv path (vlax-curve-getparamatpoint path ptlw))))
      (entmake (list '(0 . "LINE") (cons 62 256) '(8 . "Bar Chair - X") (cons 10 (polar ptlw (+ a (* pi -0.5)) ldh)) (cons 11 (polar ptlw (+ a (* pi 0.5)) ldh))))
      (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 62 256) '(8 . "Bar Chair - X") '(100 . "AcDbText") (cons 10 (polar ptlw (+ a (* pi 0.5)) ld)) (cons 40 ts) (cons 1 (itoa nlow)) (cons 50 (+ a (* pi 0.5))) '(41 . 0.7) '(51 . 0.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 0) (cons 11 (polar ptlw (+ a (* pi 0.5)) ld)) '(210 0.0 0.0 1.0) '(100 . "AcDbText") '(73 . 2))) 
    ;;; |;
      (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))) 
      )
    ;;; If you don't want to make end high marker with high value, mark this paragraph with starting ;| sign and ending |; sign
    ;;; ;|
      (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv path (vlax-curve-getparamatpoint path pthi))))
      (entmake (list '(0 . "LINE") (cons 62 256) '(8 . "Bar Chair - X") (cons 10 (polar pthi (+ a (* pi -0.5)) ldh)) (cons 11 (polar pthi (+ a (* pi 0.5)) ldh))))
      (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 62 256) '(8 . "Bar Chair - X") '(100 . "AcDbText") (cons 10 (polar pthi (+ a (* pi 0.5)) ld)) (cons 40 ts) (cons 1 (itoa nhig)) (cons 50 (+ a (* pi 0.5))) '(41 . 0.7) '(51 . 0.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 0) (cons 11 (polar pthi (+ 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))
    M.R.

  7. #17
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Hi Mr. Marko_ribar
    I fill very grateful after when I saw your replies thanks mate.
    but Sorry mate still there is a some problem. Because my range (800 to 1150) is not for height wise its for the distance between point markers.
    The code was fine which is replied by you on post no:5.

    there is some nice steps like,

    1) Command: ip

    2) Specify number of divisions : ..........

    3) Pick curve path along witch markers are to be placed
    4) Pick low point
    5) Input low value : .....

    6) Pick high point
    7) Input high value : ........

    Pick or input length of point marker <ENTER - 250.0> :

    9) Pick or input text size <ENTER - 300.0> :

    And after that i requested for modification in step (2) like,
    instate of asking the number of divisions it should calculate the number of divisions (point markers) based on the distance between "low point"(step 4) and "high point"(step 6)
    with in the range minimum and maximum distance between point markers must be (800 and 1150).

    For example:
    1) If the distance of curve between step (4 & 6) = 3000mm then number divisions will be 3 (markers).
    2) If the distance of curve between step (4 & 6) = 3500mm then number divisions will be 4 (markers).

    and the program should be continue until press enter or escape.

    Now I hope it will be clear for you.

    Thank you..

  8. #18
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    Never mind on what values ranges refer, again the same explanation : What if distance is 1255? It's not in range 800<dist<1150, so it's not 1 division, and it's in range 800<dist<1600, so it should be 1 division...

    Here is my final version - it uses just divRange=800.0 and according to that value it calculates number of segments - divisions...

    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 ( / divRange osm path lowd higd dd dst k a ld ldh n nd nhig nl nlow npl p pl pthi ptlw segs ts x )
    
      (vl-load-com)
    
      (setq osm (getvar 'osmode))
      (setvar 'osmode 35)
      (setq divRange 800.0)
      (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)))
      (setq segs (1+ (fix (/ (- higd lowd) divRange))))
      (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))
    ;;; If you don't want to make start low marker with low value, mark this paragraph with starting ;| sign and ending |; sign
    ;;; ;|
      (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv path (vlax-curve-getparamatpoint path ptlw))))
      (entmake (list '(0 . "LINE") (cons 62 256) '(8 . "Bar Chair - X") (cons 10 (polar ptlw (+ a (* pi -0.5)) ldh)) (cons 11 (polar ptlw (+ a (* pi 0.5)) ldh))))
      (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 62 256) '(8 . "Bar Chair - X") '(100 . "AcDbText") (cons 10 (polar ptlw (+ a (* pi 0.5)) ld)) (cons 40 ts) (cons 1 (itoa nlow)) (cons 50 (+ a (* pi 0.5))) '(41 . 0.7) '(51 . 0.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 0) (cons 11 (polar ptlw (+ a (* pi 0.5)) ld)) '(210 0.0 0.0 1.0) '(100 . "AcDbText") '(73 . 2))) 
    ;;; |;
      (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))) 
      )
    ;;; If you don't want to make end high marker with high value, mark this paragraph with starting ;| sign and ending |; sign
    ;;; ;|
      (setq a (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv path (vlax-curve-getparamatpoint path pthi))))
      (entmake (list '(0 . "LINE") (cons 62 256) '(8 . "Bar Chair - X") (cons 10 (polar pthi (+ a (* pi -0.5)) ldh)) (cons 11 (polar pthi (+ a (* pi 0.5)) ldh))))
      (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 62 256) '(8 . "Bar Chair - X") '(100 . "AcDbText") (cons 10 (polar pthi (+ a (* pi 0.5)) ld)) (cons 40 ts) (cons 1 (itoa nhig)) (cons 50 (+ a (* pi 0.5))) '(41 . 0.7) '(51 . 0.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 0) (cons 11 (polar pthi (+ 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))
    Regards, M.R.
    Last edited by marko_ribar; 2014-04-22 at 07:59 PM.

  9. #19
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    In your code in post #11, you have an extra character that needs to be removed.

    Find this line...
    Code:
    (setq nd (- nhig nlow):)
    ... and remove the semi-colon. That line should read as ...
    Code:
    (setq nd (- nhig nlow))
    I have not tested the remainder of your code to see if there are any other errors.

    Good luck.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  10. #20
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Re: Intermediate points height for profile

    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..

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2011-12-09, 11:23 PM
  2. Wall Height Profile
    By vkumar.205005 in forum AutoCAD Civil 3D - General
    Replies: 6
    Last Post: 2009-05-25, 06:47 AM
  3. Wall Height Profile
    By vkumar.205005 in forum AutoCAD Civil 3D - Corridors
    Replies: 0
    Last Post: 2009-05-22, 05:04 PM
  4. SSget a Polyline via 1 of 2 intermediate points
    By tany0070 in forum AutoLISP
    Replies: 4
    Last Post: 2007-05-03, 01:40 PM

Posting Permissions

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