Author Topic: CAD Setup Routine  (Read 63749 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
CAD Setup Routine
« Reply #180 on: February 05, 2004, 09:44:08 AM »
Of course when you get through the initial selection and type join you then are able to select multiple objects right? When you do, you will notice that they are all joined. Let's look at the other side: [Multiple]. Type pedit again and select M for multiple. Select a few items and make them polylines and exit out. What's happening?

amgirard2003

  • Guest
CAD Setup Routine
« Reply #181 on: February 05, 2004, 09:49:04 AM »
When i pick multiple lines when issuing the "MULTIPLE" after making my selection, it prompts you a verification (Y/N) if you want to convert them to a polyline.

daron

  • Guest
CAD Setup Routine
« Reply #182 on: February 05, 2004, 10:00:06 AM »
But it does not join them. It does serve a purpose in making everything a polyline, though. At any rate, either way will work. From your code, I assume you want to be able to select all lines and arcs at once and just have them joined, so, ssget will be fine. Let's take your code again.
Code: [Select]

(setq ss (ssget))
(setq ssl (sslength ss))
(setq cnt 0)

See if you can figure out what you need to do from here. Notice I have yet to use ssname or entget. Show how you're going to use them by writing code. No pseudo-code. You've given enough of that, plus I'm awful when it comes to that stuff. If I have an idea, I start hacking away at code until I get it.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #183 on: February 05, 2004, 10:21:06 AM »
Code: [Select]


(setq ss (ssget))
(setq ssl (sslength ss))
(setq cnt 0)

(repeat ssl
  (setq ename (ssname ss cnt)); set the first entity to ename
  (setq elist (entget ename)) ; get the name of that first entity.
   


This is where i'm at so far... running into a stumbling block now..

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
CAD Setup Routine
« Reply #184 on: February 05, 2004, 10:28:45 AM »
Let me make a little comment here ...

How are you planning on joining the polylines once created? The answer may make a difference in the way the selection set is handled.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
CAD Setup Routine
« Reply #185 on: February 05, 2004, 10:34:02 AM »
Daron, arrays are - at least historically - indexed by offsetting addresses. In order to index that way, you need contiguous spaces in memory and statically sized data types.
Lists are like linked lists. They do not require contiguous memory and can be dynamically allocated without flushing the entire structure.

I know you used the term loosely and for the purpose of understanding. Just be aware that the term 'array' do not quite cover all of the features of a list. For example, using the term 'multidimensional array' for a nested list can give the impression that each element has to hold the same number of levels - which is not correct.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #186 on: February 05, 2004, 11:12:56 AM »
I would like it to work like this
pick the objects first convert them to plines and the join them individually..

a little frustrated....  :x

daron

  • Guest
CAD Setup Routine
« Reply #187 on: February 05, 2004, 11:17:34 AM »
True, but in the case with layers, we'd want to do some math to make sure all lists in the main list have the same elements, right? As I ponder your statement a bit, it seems that lists and nested lists are more flexible than arrays, but can also have more issues, in that if you have a list of 5 layer name and a list that only contain 4 colors and the 3rd color is what is missing, you'd end up with (5 3 2 1 nil) not (5 3 nil 2 1) appended to their respective layers, right?

Thanks for keeping me in check though. Any time I'm explaining something and it's not quite right, feel free to correct me. I may understand how many functions work, but my explanation does tend to get a little skewed and opinionated.

daron

  • Guest
CAD Setup Routine
« Reply #188 on: February 05, 2004, 11:19:01 AM »
Quote from: amgirard2003
I would like it to work like this
pick the objects first convert them to plines and the join them individually..

a little frustrated....  :x


That seems a little backward of the way the command works normally.
I was thinking you wanted to select all the lines at once and have them join automatically?

amgirard2003

  • Guest
CAD Setup Routine
« Reply #189 on: February 05, 2004, 11:44:52 AM »
i can't seem to explain exactly what i want to do..

I'm just frustrated that i can't seem to put 1+1 together to = 2.. I feel like i'm getting 100 as my answer...
I just can grip the logic when you all put your code together..
What i mean by that is when you get a problem...
when you start to dissect that problem and start writting code to solve the problem,  you all seem to have a structure to your code... (this goes here and that there, oh i should put this here as well)  it's that what i'm not getting..I'm not getting how you all put your code together... I'm not fully understanding why you would use this over that or do it this way instead of that way...

I've learned a lot about all the function and how they work individually, but when trying to put them together to function as a group.. i just throw my arm's in the air and just wanna yell!!!..
And that's when i start to get frustrated...  :x

I just want to say you've all done a great job and teaching me everything so far... I just thought i would bring this up to maybe direct your thougths to this point..
I guess i should post a routine and understand your thinking behind it..
here's a simple one... i understand how it works... but mentally it would have taken me days to even figure where to start with the code..
What would be your thoughts when doing this routine?


Code: [Select]

(defun C:COPYROT (/ SS1 P1 P2 RT)
  (prompt "\nCopy and Rotation combined.")
  (setq SS1 (ssget)
RT  0.0
  )
  (if SS1
    (progn
      (setq P1 (getpoint "\nBase point for copy: "))
      (if P1
(while (setq P2 (getpoint P1 "\nCopy point: "))
 (setq TMP (getangle P2
     (strcat "\nRotation angle <0.0>: ")
   )
 )
 (if TMP
   (setq RT TMP)
   (setq RT 0.0)
 )
 (command "_COPY"
SS1
""
P1
P1
"_MOVE"
SS1
""
P1
P2
"_ROTATE"
SS1
""
P2
(angtos RT)
  ) ;;end Command
  (setq P1 P2)
) ;;end WHILE P2
      ) ;;end If P1
    ) ;;end PROGN
  ) ;; end IF SS1
)


If anyone wants to jump off this sinking ship feel free to do so.... :(

daron

  • Guest
CAD Setup Routine
« Reply #190 on: February 05, 2004, 11:55:36 AM »
Don't know. As far as jumping ship on you? What kind of people would we be if we did that? Nobody jumped ship on me or anybody else, when we were going through the same frustrations. Don't worry, as long as you don't jump ship, I'm pretty sure nobody else will either. Keep at it. One day, it'll all just click and you'll wonder why it took so long to understand it. Let's not get sidetracked. That little tutorial I did on the similarities between lists and arrays came from reading about arrays while pondering the way you want to set your standards up for layer creation. If you want we can get back to that. I think I have an idea involving that.

amgirard2003

  • Guest
CAD Setup Routine
« Reply #191 on: February 05, 2004, 01:05:41 PM »
I should give you a run down as to what i have a clear grasp of..

Variables:

Local Variable: are variables defined after the /, are available to that function only and reset themselves when the routine exits.
ex: (Defun c: cp ( / on off)  on and off are local variables

Global Variable: are variables that are not defined as either arguements before the / or within the routine itself, being global they are available to all routine and do not clear themselves when the routine exits..
ex: (defun c: cp ( on off /) ; "on, off" are recognized as argurments
      (setq an "Hello") ; "an" is a global variable

(getpoint): used to specify a point on the screen and return  X, Y corrdinates of the selected point.
(setq a (getpoint "Please select Point"))

(getangle): get an angle by selecting 2 points or input from the keyboard
(setq a (getangle "Enter Angle" ))

(getkword): used with Initget to retrieve keyword selections.
(initget 1 "L E")
(setq a (getkword "(L)ength or (E)nd"))

(getvar): gets an AutoCad variable.
(setq a (getvar "cmdecho"))

(getdist): requests input from the user either through clicking between 2 points or keyboard.
(ex. (setq a (getdist "Enter Length "))

(getreal): requests input as real number.
(ex. (setq a (getreal "Enter a Number" ))

Real Number: a number that includes a decimal point


(defun): to define a custom function.. if (defun c:new) then it will act like an AutoCad command.

That's a quick run down of what i've encountered so far and feel i've got a good handle on, along with everything else you have shown me in this thread as well..

daron

  • Guest
CAD Setup Routine
« Reply #192 on: February 05, 2004, 01:26:53 PM »
Put together a list of all layers, on-off, frozen-thawed, locked-unlocked, layer colors, linetypes, lineweights, plottability. Do you use paperspace?

amgirard2003

  • Guest
CAD Setup Routine
« Reply #193 on: February 05, 2004, 01:42:33 PM »
Yupe.... that's the real way to plot in Autocad... big pet peeve of mine is consultants that either draw and border everything in model space or they will have complete drawing drawn in paperspace... blows my mind sometimes..

I have a list right right next to me..

daron

  • Guest
CAD Setup Routine
« Reply #194 on: February 05, 2004, 01:54:20 PM »
Well, start typing.