Author Topic: Common offsets routine  (Read 5216 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Common offsets routine
« on: February 07, 2008, 09:27:55 AM »
Hey guys,

I am in desperate need of a routine that has a dialogue box which would contain my common offsets. What I ultimately need is all of the 1/16" fractions and it would be nice to have a seperate inches field. I know there is something similar to this idea called quick offset at caddee.com but unfortunately i cannot install .exe files here. I also don't really like that one either because if i remember correctly it sorts them based on last use and not by value so the order is always changing which was annoying. The program also doe not have a seperate field for inches which would be excellent. Has anyone ever thought of doing something like this or done it already. Here is why I really need this type of thing. I am having to fix a bunch of drawings that were drawn inaccurately and the only way i have found to get this correct is by offsetting the correct distance then stretching the model to match. Now that I'm really thinking about it would need to offset to another layer and which would lock itself. These are only reference lines so I will need to erase them when I am done and need to isolate them. I'm just thinking aloud so if anyone has any thoughts about this please help me out because I am dying over here doing this manually.  :|

GDF

  • Water Moccasin
  • Posts: 2081
Re: Common offsets routine
« Reply #1 on: February 07, 2008, 10:09:08 AM »
Dan

Here is what I use...(not a standalone routine) but it will hopefully give you some ideas.
If you are interested in it, I can send more of the missing sub routines.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Common offsets routine
« Reply #2 on: February 07, 2008, 10:50:27 AM »
My suggestion would to use Xlines offsett to layer name like "quality check".  I would not lock them so as you can easily erase them by zooming out and selecting all or you selectively erase while you zoomed in.  You could even roll a piece of code to select all objects on that layer and erase them.  By using xlines with the vertical or horizontal option you can be assured that the line is drawn with tweaked rotation when it suppose to be at a true angle. 

as for the distances, if you are wanting 1/16" increments; that doesn't sound very common.

Just my two cents.  Good luck
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

GDF

  • Water Moccasin
  • Posts: 2081
Re: Common offsets routine
« Reply #3 on: February 07, 2008, 11:00:59 AM »
My suggestion would to use Xlines offsett to layer name like "quality check".  I would not lock them so as you can easily erase them by zooming out and selecting all or you selectively erase while you zoomed in.  You could even roll a piece of code to select all objects on that layer and erase them.  By using xlines with the vertical or horizontal option you can be assured that the line is drawn with tweaked rotation when it suppose to be at a true angle. 

as for the distances, if you are wanting 1/16" increments; that doesn't sound very common.

Just my two cents.  Good luck

I second that approach also...we use xlines to verify alignment here in our office. We place the xlines to a no plot layer.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #4 on: February 07, 2008, 11:11:55 AM »
gary that looks interesting. i downloaded it but couldn't get it running here. i guess it's because it's missing some stuff as you said. can you please upload everything i'd need so i can fiddle with it this weekend. thanks. Krushert I tried xlines but couldn't get past the through poont prompt. what am i supposed to do here? i already have a routine for creating reference lines so that's not the issue. the issue is i'm sick of typing in all kinds of values and i'd like to be able to put these offsets on their own layer for easy cleanup later. thanks anyway though for the suggestion

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #5 on: February 07, 2008, 11:16:46 AM »
figure out xline i think. this might be useful for aligning my views but i don't know able storing offset values? gary what do i type to get the dialogue box up?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Common offsets routine
« Reply #6 on: February 07, 2008, 11:37:10 AM »
Here is a rework of my Wall Offset Routine.
You enter o16 to round off to 1/16.
Enter o8 to use 1/8. You can add more.

Pick an object that needs to be moved.
Then pick the line that is stationary and to be measured from.
The routine presents you with a prompt of the existing measurement, and a rounded measurement.
Press "+" [enter] to increment the measurement by the round amount (1/16) in this case.
Or press "-" [enter] to reduce the measurement by the round amount.
Press enter to except the new measurement.

The new target line is created on layer "0" at the new measurement.
You are then asked to select via window the objects to be stretched.

The objects are stretched & the new line is erased.

The routine has limitations:
Will not work on rectangles as the picked objects.
Objects must be aligned with the XY axis.

Remember this is just a quick fix solution.
Code: [Select]
;;  02/07/2008  CAB
;;  offset lines by picking the distance & line to offset
;;  routine calcs fractional distance, confirms distance
;;  then offsets the line to layer, allows you to pick window
;;   to be streched. Then erases the line
;;
;; The routine has limitations:
;; Will not work on rectangles as the picked objects.
;; Objects must be aligned with the XY axis.

(defun OffsetRnd (rndto / DIST OFS P1 p2 p3 p4 USERCMD USEROS ent rndto *error*)
    (vl-load-com)
  (defun *error*( err)
    (and useros (setvar "osmode" useros) (setq useros nil))
    (and ent (entdel ent) (setq ent nil))
    (princ err)
    (princ)
  )
  (command "undo" "begin")
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "osmode" 512) ; near

  (setq rndto (/ 1.0 rndto))
  
  (setq p1 (getpoint "\nPick a point near the miss aligned object."))
  
  (setq ent (entsel "\nSelect Line to offset.")
        obj (vlax-ename->vla-object (car ent))
        p2 (vlax-curve-getclosestpointto obj p1 t);perp point
        dist (distance p1 p2)
        d (*(fix(+(/ dist rndto) 0.5)) rndto)
  )

  (while
    (cond
      ((= (setq ofs (getstring t (strcat "\nEnter the offset distance.[+ -] Now= "
                                         (rtos dist 4 6) " <"(rtos d)"> "))) "")
       (setq ofs d)
       nil
      )
      ((= ofs "+") (setq d (+ d rndto)))
      ((= ofs "-") (setq d (- d rndto)))
      ((null (setq ofs (distof ofs))) (princ "\nInvalid input, Try again."))
      ((numberp ofs) nil)
      (t  (princ "\nInvalid input, Try again."))
    )
  )
  
  (setvar "osmode" 0)

  (command ".offset" ofs (car ent) "none" p1 "")
  (setq ent (entlast))
  (command ".change" ent "" "P" "LA" "0" "")
  (if (and (setq p3 (getpoint "\nSelect objects to stretch by crossing-window"))
           (setq p4 (getcorner p3 "\nSpecify opposite corner:"))
           )
    (command ".stretch" "CP" p3 (list (car p3)(cadr p4))
             p4 (list (car p4)(cadr p3)) "" "" p1 (polar p1 (angle p2 p1) (- ofs dist)))
  )
  (entdel ent)
  (setvar "CMDECHO" usercmd)
  (setvar "osmode" useros)
    (command "undo" "end")

  (princ)
)

(defun c:o16 () ; Offset to 1/16"
  
  (OffsetRnd 16)
  (princ)
  )

(defun c:o8 () ; Offset to 1/8"
  
  (OffsetRnd 8)
  (princ)
  )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Common offsets routine
« Reply #7 on: February 07, 2008, 11:41:34 AM »
If you know the distance you want to stretch, why don't you just stretch with the 'from' from the osnap menu, and type in the distance (and move the mouse in the correct angle) you want to stretch it?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #8 on: February 07, 2008, 12:15:05 PM »
i will play with this cab thanks. tim, the reason i don't wanna use from is that the difference is always something like .05724692
Would you wanna type this in for every line in a drawing, I think not  :realmad:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Common offsets routine
« Reply #9 on: February 07, 2008, 12:22:33 PM »
i will play with this cab thanks. tim, the reason i don't wanna use from is that the difference is always something like .05724692
Would you wanna type this in for every line in a drawing, I think not  :realmad:
You don't type the difference, you type what you want it to be.  So if it is supposed to be 2 1/16, you go into the stretch command, pick the objects, pick the base point, then enter 'from' on the command line (or pick it from the osnap menu), then pick the point you want to stretch it from, and type in 2-1/16 (with your mouse in the direction you want to stretch it), and the new length will be 2 1/16.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Common offsets routine
« Reply #10 on: February 07, 2008, 12:32:53 PM »
i will play with this cab thanks. tim, the reason i don't wanna use from is that the difference is always something like .05724692
Would you wanna type this in for every line in a drawing, I think not  :realmad:
You don't type the difference, you type what you want it to be.  So if it is supposed to be 2 1/16, you go into the stretch command, pick the objects, pick the base point, then enter 'from' on the command line (or pick it from the osnap menu), then pick the point you want to stretch it from, and type in 2-1/16 (with your mouse in the direction you want to stretch it), and the new length will be 2 1/16.
:doa:  I should have been on that one.

I use the From everyday.
Where is that Slaps Forehead smiley?
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Common offsets routine
« Reply #11 on: February 07, 2008, 12:44:03 PM »
i will play with this cab thanks. tim, the reason i don't wanna use from is that the difference is always something like .05724692
Would you wanna type this in for every line in a drawing, I think not  :realmad:
You don't type the difference, you type what you want it to be.  So if it is supposed to be 2 1/16, you go into the stretch command, pick the objects, pick the base point, then enter 'from' on the command line (or pick it from the osnap menu), then pick the point you want to stretch it from, and type in 2-1/16 (with your mouse in the direction you want to stretch it), and the new length will be 2 1/16.
:doa:  I should have been on that one.

I use the From everyday.
Where is that Slaps Forehead smiley?
I know.  Once I found it I told everyone in the office I worked for.  It is one of the handest things.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Common offsets routine
« Reply #12 on: February 07, 2008, 12:50:21 PM »
Dan if you change your Units to Architectural and max out the precision you will see
fractions with the Distance command. Also change you dimension to a Architectural
style while working on this fix then change them back.
This will eliminate the need for a Fractions conversion chart.

HTH
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Common offsets routine
« Reply #13 on: February 07, 2008, 12:50:52 PM »
Tim
Great tip, I never used it before. :-o
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

daron

  • Guest
Re: Common offsets routine
« Reply #14 on: February 07, 2008, 01:07:27 PM »
Wow. I wouldn't have guessed.^^ I use from all the time. I used to use tracking more, but it went the way of the dodo bird, sort of. It's still available if you type track. I liked it because it was a better ortho than orthomode, but its usefulness has died out and from is now king. From also aleviates (mostly) the need for x y point filters.

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #15 on: February 07, 2008, 01:13:40 PM »
tim that's very interesting i'll have to remember that. cab i tried your routine and it does what it says too. the problem i discovered with both of these is that they only stretch in one direction. this works fine if it is the edge that is off but if it is and object on a bigger object it becomes off center. What I would need for this situation is to get the difference then divide that by 2 and then allow me to stretch through both sides so it stays centered on the whole object. Does that make sense?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Common offsets routine
« Reply #16 on: February 07, 2008, 01:17:40 PM »
Tim
Great tip, I never used it before. :-o
You're welcome.   :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: Common offsets routine
« Reply #17 on: February 07, 2008, 01:17:58 PM »
I used to use a transparent function called (ref) that was made as an early Lisp form of from.

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #18 on: February 11, 2008, 11:00:56 AM »
Hey Gary,

You had said you would send me the rest of your routine if I was interested. I'm curious to try it out so can you post it. Thanks


GDF

  • Water Moccasin
  • Posts: 2081
Re: Common offsets routine
« Reply #19 on: February 11, 2008, 04:51:03 PM »
Hey Gary,

You had said you would send me the rest of your routine if I was interested. I'm curious to try it out so can you post it. Thanks



Dan

The sub functions are nested too deep...plus I save settings to windows registry.
I will try and make a standalone dialog routine. And the buttons along the bottom
of the dialog are hot links to the main arch program routines which you do not have.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #20 on: February 11, 2008, 05:21:00 PM »
thanks gary. what i am really looking for out of this is a dialogue box that has a list of my common offsets that i can select instead of typing them all the time. i have seen alot of offset routines but none that is really intuative. Now that I'm thinking about it. It would be nice to be able to put in some kind of seperator(s) too to make the list easy to read. I do tons of offsetting in my work and if I don't find a better way soon my poor hands are gonna fall off.  :-o

GDF

  • Water Moccasin
  • Posts: 2081
Re: Common offsets routine
« Reply #21 on: February 11, 2008, 05:27:34 PM »
thanks gary. what i am really looking for out of this is a dialogue box that has a list of my common offsets that i can select instead of typing them all the time. i have seen alot of offset routines but none that is really intuative. Now that I'm thinking about it. It would be nice to be able to put in some kind of seperator(s) too to make the list easy to read. I do tons of offsetting in my work and if I don't find a better way soon my poor hands are gonna fall off.  :-o

In that case why not make a toobar with your most commonly used offsets.

Code: [Select]
**ARCH_OFFSET
[_Toolbar("Offset, _Floating, _Hide, 900, 700, 1)]
[_Button("Offset Utilities", ARCH_OFFSET, ARCH_OFFSET)]OFU
[_Button("Offset 3.5", ARCH_OFF35, ARCH_OFF35)](setvar "offsetdist" 3.5);(command "offset" "");
[_Button("Offset 5.5", ARCH_OFF55, ARCH_OFF55)](setvar "offsetdist" 5.5);(command "offset" "");
[_Button("Offset 6.0", ARCH_OFF6, ARCH_OFF6)](setvar "offsetdist" 6.0);(command "offset" "");
[_Button("Offset 12.0", ARCH_OFF12, ARCH_OFF12)](setvar "offsetdist" 12.0);(command "offset" "");
[_Button("Offset 24.0", ARCH_OFF24, ARCH_OFF24)](setvar "offsetdist" 24.0);(command "offset" "");
[_Button("Single Offset Delete Original", ARCH_DSOF, ARCH_DSOF)]+
(setq loop 1);(while (= loop 1)(C:DSOF));(princ))
[_Button("Double Offset Delete Original", ARCH_DDOF, ARCH_DDOF)]+
(setq loop 1);(while (= loop 1)(C:DDOF));(princ))
[_Button("Double Offset @3.5 Delete Original", ARCH_DDOF3, ARCH_DDOF3)]+
(setvar "offsetdist" 3.5);(setq loop 1);(while (= loop 1)(C:DDOF));(princ))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ELOQUINTET

  • Guest
Re: Common offsets routine
« Reply #22 on: February 11, 2008, 07:46:55 PM »
gary,

i already have a toolbar from a previous job but the amount of them i need makes a toolbar not really ideal for my current needs. i'd just like to be able to add them as i go and not worry about bitmaps. i am also somewhat reluctant to go that route for the reason that we are about to upgrade to 2007 soon and i don't feel like relearning the old method only to upgrade in a week. i will take a look at your bitmaps though as i may want to go that route eventually. thanks