TheSwamp

CAD Forums => CAD General => Topic started by: MSTG007 on January 16, 2018, 11:06:18 AM

Title: Offseting by Selecting points then divide
Post by: MSTG007 on January 16, 2018, 11:06:18 AM
Dumb question... Is there a procedure to offset then select a distance between two points, then say divided that distance by 3 and it calculates that value? (Then normal offsetting).

I hope that makes sense lol. Currently, I am just getting a distance, type via the ('CAL) command, then offset and type in that value.

Thanks for any advice...
Title: Re: Offseting by Selecting points then divide
Post by: mjfarrell on January 16, 2018, 04:20:54 PM
are you really offsetting, or might this be a place for a tool like the one on the points tool palette to project slopes, etc?
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 16, 2018, 04:39:16 PM
You could be right... I need to go check that out. That might be what I am looking for.
Title: Re: Offseting by Selecting points then divide
Post by: mjfarrell on January 16, 2018, 04:42:27 PM
Also, as an experiment
I just tried this @ offset command


OFFSET

it asks for distance I entered 2/3 it accepted that
I tried 2*3 it hated that

So it will take some fractions....but not other math at command prompt
Title: Re: Offseting by Selecting points then divide
Post by: mjfarrell on January 16, 2018, 04:43:31 PM
Try Create Points-Interpolate  under utilised in every sense of the word
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 16, 2018, 04:43:43 PM
Thanks for trying it out and letting me know.
Title: Re: Offseting by Selecting points then divide
Post by: CAB on January 31, 2018, 12:16:41 PM
Maybe this?

Code: [Select]
(defun c:div (/ d n s)
    (and
      (setq d (getdist "\nPick distance"))
      (setq n (getreal "\nEnter divider"))
      (setq s (/ d n))
    )
  s
)

Command: offset

Current settings: Erase source=No  Layer=Source  OFFSETGAPTYPE=0
Specify offset distance or [Through/Erase/Layer] <Through>: 'div
Title: Re: Offseting by Selecting points then divide
Post by: ribarm on January 31, 2018, 01:41:01 PM
I understood that you specify point [Through] option, so apparently you don't know main distance in advance... So what you could try is perhaps something like this :

Code: [Select]
(defun c:offptdiv ( / p c d n )
  (vl-load-com)
  (setq p (getpoint "\nPick or specify point : "))
  (while (or (not (setq c (car (entsel "\nPick curve for offset...")))) (if c (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getstartpoint (list c)))))
    (prompt "\nMissed or picked wrong entity type...")
  )
  (setq d (distance p (vlax-curve-getclosestpointto c p)))
  (initget 7)
  (setq n (getint "\nSpecify divisor : "))
  (vl-cmdf "_.OFFSET" (/ d n) c "_non" p "")
  (princ)
)

I just wrote the code from my head, so you probably need debugging...
HTH., M.R.
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 31, 2018, 01:53:34 PM
For example, I have a vertical and a horizontal line. I want to offset out a grid.
I know I want to use the horizontal line but I really don't know the distance.
With the routine, I could select the distance by picking the begin and end point of the horiz line.
Then I can say I want 5 rows.
Then offset that distant without use a calculator is kinda what I was seeing.

I don't know what I did, I can not seem to get this to work.

Title: Re: Offseting by Selecting points then divide
Post by: ribarm on January 31, 2018, 02:04:59 PM
I've corrected my code, but still not quite sure is it just the thing you are looking for...
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 31, 2018, 02:25:11 PM
I think at the beginning of the code, I would want to click the distance. (From first point to the last) (I can only click once).
 
Then it asks for a curve to offset. I select the vertical Line.

It asks for a specify divisor, I type in 5. (Value must be positive and nonzero) and goes to the offset command.

Code: [Select]
Pick or specify point : _endp,_app of
Pick curve for offset...
Specify divisor : 5
Value must be positive and nonzero.
Specify offset distance or [Through/Erase/Layer] <Through>:
Select object to offset or [Exit/Undo] <Exit>:
Command:
Title: Re: Offseting by Selecting points then divide
Post by: cadtag on January 31, 2018, 03:22:56 PM
at the prompt for a distance, key in (/ (getdist) 3), pick your two points (osnaps allowed) and rock on.  change the number 3 to whatever suits your needs.
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 31, 2018, 03:25:35 PM
its literally that easy?
Title: Re: Offseting by Selecting points then divide
Post by: CAB on January 31, 2018, 04:13:16 PM
My code does the same thing with less syntax.  8)
Title: Re: Offseting by Selecting points then divide
Post by: MSTG007 on January 31, 2018, 04:19:29 PM
Geesh its been a long day! CABs. yours is easier to execute lol. guys sorry about the head ache.