Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extrude

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
kulfi
1136 Views, 9 Replies

Extrude

I have attached a 3dpolyline drawing coming from Utility Design i want to extrude this along its path and make it a 3d solid Pipe, Please let me know or if i can get the code is better

defun c:3DS()
(Setq Ss_Set (ssget "X" '((0 . "Polyline"))))
(setq Ss_Length (sslength Ss_Set))
(setq count 0)
(repeat Ss_Length
  (setq Ent (ssname Ss_Set count))
       (setq Ent_Data (entget Ent))
       ;(setq U1 (CDR (ASSOC 10 Ent_DATA))); i have the problem here how can i get the start Point
       ;(setq U2 (CDR (ASSOC 11 Ent_DATA))); i have the problem here how can i get the End Point
      
(COMMAND "CLAYER" P-LAYER)
(COMMAND "UCS" "W")
(SETQ SNAP1 (GETVAR "OSMODE"))
(SETQ APERTURE-1 (GETVAR "APERTURE"))
(COMMAND "OSMODE" 5)
(COMMAND "APERTURE" 4)
(initget 1)
(setq U1 (CDR (ASSOC 10 Ent_Data))) 
;(setq u1 (getpoint "\nSelect From: ")
(initget 1)
(setq U2 (CDR (ASSOC 11 Ent_Data))) 
;(setq u2 (getpoint "\nSelect To: ")
(initget 7)
(setq circ_dia (getreal "\nCicle diameter: <>"))
(COMMAND "UCS" "ZAXIS" U1 U2)
(setq u3 (TRANS U1 0 1))
(COMMAND "CIRCLE" U3 "D" circ_dia)
(setq ent (entlast))
;(command "erase" ent )     
(COMMAND "UCS" "W")
(command "extrude" ent "" U1 U2 "")
(COMMAND "CLAYER" "0")
(COMMAND "OSMODE" SNAP1)
(COMMAND "APERTURE" APERTURE-1)
(COMMAND "UCS" "W")
(PRINC)
(setq count (+ 1 count)) 
)

 

 

Thanks

Kulfi
Electronics Engineer

Pind Saudi Arabia



9 REPLIES 9
Message 2 of 10
bhull1985
in reply to: kulfi

Take a look at this afralisp page, it shows how to do that using Vla commands, which you should be able to incorporate into your routine easily 🙂

 

http://www.afralisp.net/archive/methods/list/addline_method.htm

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 3 of 10
bhull1985
in reply to: bhull1985

As well as these from theswamp.org, which you may need a membership to view.

If you're going to be lisping it'd be a great idea to get a membership to theswamp if you dont already, it's free.

 

http://www.theswamp.org/index.php?topic=22872.0

 

http://www.theswamp.org/index.php?topic=32057.0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 4 of 10
Kent1Cooper
in reply to: kulfi

That looks like it's set up for Line entities only.  Try the several offerings on this threadThey also contain other elements having to do with categorization of Layers and different tube diameters, but they will show how you can extrude/sweep a Circle along any kind of path object to make a pipe-like Solid.

Kent Cooper, AIA
Message 5 of 10
kulfi
in reply to: kulfi

Hi,

actually i am drawing a conductor in AutoCAD utility Design where it does not show the dianeter of the cable so i am taking it to AutoCAD or Civil 3d to convert this to a 3dmodel but the problem here is whoe i can avoid the start and end point of the conductor and make a 3d model.

thanks

Kulfi
Electronics Engineer

Pind Saudi Arabia



Message 6 of 10
Kent1Cooper
in reply to: kulfi


@Kulfi wrote:

Hi,

actually i am drawing a conductor in AutoCAD utility Design where it does not show the dianeter of the cable so i am taking it to AutoCAD or Civil 3d to convert this to a 3dmodel but the problem here is whoe i can avoid the start and end point of the conductor and make a 3d model.

thanks


Maybe I don't understand correctly what you're trying to do -- by "avoid the start and end point" do you mean that you don't want to have to pick those points, but would like a routine to find them for you?  If so, the TUBE command defined in Message 7 of the linked thread will do that.  It asks for a diameter for the circular cross section [it uses the word Tubular, which conduits are -- you can change the wording if you like], and for you to select path objects.  It works on many different path object types [including the 3DPolylines you mention in your first Message], will do as many as you want [of the same tubular diameter] at once, and finds the ends itself so you don't need to select them.  It should work in AutoCAD or any overlay program.

 

If that's not what you want, a detailed description of what you're starting with, what you want the User to do, and what the end result should be, would be helpful.

Kent Cooper, AIA
Message 7 of 10
kulfi
in reply to: Kent1Cooper

Now with connection to the previous problem where we had a 3dpolyline to convert to 3d solid now if i have a square or rectange object and i want to extrude to the same path how will i do that.

thanks

Kulfi
Electronics Engineer

Pind Saudi Arabia



Message 8 of 10
Kent1Cooper
in reply to: kulfi


@Kulfi wrote:

... now if i have a square or rectange object and i want to extrude to the same path ....


The attached file is a conversion of the circular-cross-section Tube routine, TubeSquare.lsp with its TUBESQ command.  Like the other one, it doesn't work with any existing square or rectangle, but asks for an edge length for the square section, and draws its own square to extrude along each path.  The rotational orientation of the square along the path can be affected by the direction the path heads from its start point [which way is "up" that will define the direction of the sides].  A similar routine could be made that would ask for two dimensions for a rectangle, but you would get into questions about how the rectangle is rotationally oriented in relation to the path.

 

If you have an existing square or rectangle, extruding it along a 3D path may not give you the result you expect, depending on its relative orientation and the comparative position and direction(s) of the path(s).  Also, the extrusion may follow the shape of the path object, but not actually be along it.  And in brief experiments, I find that sometimes it won't do such an extrusion with an existing object if the positional relationship is wrong in some way [I haven't been able to figure out what makes the difference], so using an existing object could sometimes fail.  That's why drawing the square to extrude at the start of each path and oriented to its starting direction seems the only way to go.

Kent Cooper, AIA
Message 9 of 10
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:
....  A similar routine could be made that would ask for two dimensions for a rectangle, but you would get into questions about how the rectangle is rotationally oriented in relation to the path.

....


I came up with one, posted at the other similar thread.

Kent Cooper, AIA
Message 10 of 10
kulfi
in reply to: kulfi

actually i do have any duct bank to make in AUD 2014 and what exactly i want a rectangle with different width , length and depth which can be extruded on the 3dpolyline path and than i can use this as a duct bank.

thanks

Kulfi
Electronics Engineer

Pind Saudi Arabia



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost