DoubleCAD XT > Tips and Tricks

(PRO only): Creating Parametric Parts and using scripts.

(1/3) > >>

wmanning:
One important DoubleCAD XT Pro feature is the PPM, or Parametric Parts Manager. 

While looking for a couple easy scripts I wrote, I found two others from Brian that are probably less complex operations. 

I'm not giving them to you in .ppm form (intentionally  ;)).  You can find documentation on the PPM beginning on page 307 of the DoubleCAD XT Pro manual.

With the scripts below, you will need to open the Parametric Part Script Manager palette, click on the New icon, then cut and paste the script into the palette.  Click to save it somewhere.  Then press the play button (with the right arrow).  That will place an instance of the part in the drawing.  Select that part and go to Selection Info to change the parametric aspects...

Script 1 (just the black text):

Wide=Parameter("Wide", 1, Interval(1,10));
Long=Parameter("Long", 4, Interval(1,10));
High=Parameter("High", 9, Interval(1,10));
Dist=Parameter("Distance", 12, LINEAR);

///Draw Geometry
Hole1=Rectangle(8,8);
Base1=Rectangle(10,10);

Block1=Thickness(Base1,10);

Hole2=Thickness(Hole1,12);
Hole3=Move(Hole2,0,0,-1);
Hole4=RotateY(Hole3, 90);
Hole5=Move(Hole4,-5,0,5);
Hole6=RotateZ(Hole4, 90);
Hole7=Move(Hole6,0,-5,5);

Block3=BooleanSubtract(Block1,Hole3);
Block4=BooleanSubtract(Block3,Hole5);
Block5=BooleanSubtract(Block4,Hole7);
Block6=SetProperties(Block5,"PenColor"= 0xFF0000);


//arrange blocks
Final1 = Move(Block6,Dist,0,0,Wide);// Make the number of copie3w = wide
Final2 = Move(Final1,0,Dist,0,Long);// Make the number of copie3w = long
Final3 = Move(Final2,0,0,Dist,High);// Make the number of copie3w = high

Output(Final3);




XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And Script 2:

Units(1[in]);

Wid=Parameter("Picket Width", 2, LINEAR, Set(2, 2.5, 3, 4, 6));
Dep=Parameter("Picket Thickness", 1, LINEAR, Set(1, 2, 3));
PickHeight=Parameter("Picket Height", 48, LINEAR, Set(36,48,60,72));
Pointy=Parameter("Depth of Picket Point", 4, LINEAR, Set(2,4,6,8,10));
Len=Parameter("Length of Fence", 72, LINEAR, GreaterThan(72));
Num=Parameter("Number of Pickets", 12, LINEAR, GreaterThan(6));
RailWid=Parameter("Width of Rails", 4, LINEAR, Set(2, 2.5, 3, 4, 6));
RailDepth=Parameter("Depth of Rails", 2, LINEAR, Set(2, 2.5, 3, 4, 6));
BotRail=Parameter("Height of Bottom Rail", 12, LINEAR, Set(0, 6, 12, 18));
TopRail=Parameter("Height of Top Rail", 36, LINEAR, Set(24, 36, 48, 60));
PostSize=Parameter("Size of Post", 4, LINEAR, Set(2,4,6));


Div=Len/(Num-1);
Space=(Div-(Wid/(Num-1)));


// Pickets
PicketProfile=Polyline(
Point(0,0),
Point(0,-Wid),
Point((PickHeight-Pointy),-Wid),
Point(PickHeight,-Wid/2),
Point((PickHeight-Pointy),0),
Point(0,0)
);

Picket1=Thickness(PicketProfile,Dep);
Picket2=RotateX(Picket1,-90);
Picket3=RotateY(Picket2,-90);
Picket4=Move(Picket3,0, 0, 0);
Picket5=RotateZ(Picket4, 180);
Picket6=Move(Picket5, Space, 0, 0,(Num));
Picket7=Move(Picket6,-Space, 0, 0);


Output (Picket7);

//Rails
Rail1=Rectangle(RailWid,RailDepth);
Rail2=RotateY(Rail1,90);
Rail3=Thickness(Rail2, Len);
Rail4=Move(Rail3, 0, RailDepth/2, BotRail);
Rail5=Move(Rail4, 0, 0, TopRail-BotRail);

Output(Rail4,Rail5);


Post=Rectangle(PostSize,PostSize);
Post2=Thickness(Post,TopRail+RailWid/2);
Post3=Move(Post2, -PostSize/2, PostSize/2,0);

Output(Post3);


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
That's all there is to it.  Try looking at them in an ISO view...

-- William

wmanning:
It isn't easy to write a .ppm file from a script if it isn't documented.  That documenation didn't make it into the final DoubleCAD XT Pro manual, so I am adding a strong draft of it here.  The attached document is taken from the TurboCAD Pro v16 documentation and was converted for DoubleCAD.  Any problems with formatting are my fault.

Parts created as .ppm files can be used in both applications.  There are one or two commands that may be TurboCAD only functions, and I'm looking into that.  They apply the chamfers or fillets to 3D objects.

And if you are wondering what a .ppm part even looks like in action, there is a new video with a couple of basics in 2D alone... coming Monday.  Until then, try it!

I'd love to see some people give this function a try... I know it is not for everyone!

- william

seasdes:
How might parametric parts be usefull to the architectural industry?
Seasdes

makr:
Thank you. I've been meaning to read up on this - ever since you told me that it was like sketchup's dynamic components - but more powerful (and less easy  ;D )

I'd like to second Seasdes's query/request: could you give an architectural example, please - like, say, railings where the no. of balusters increase depending on length. (Would that be a valid example?)

Thanks.

wmanning:
We'll get back to you on the architectural items because my head is more in the weekend mode than list making mode ;) but a few examples...

Try the second script above for a dynamic picket fence.  You could make that into a balustrade. You railings with balusters increasing in numbers is valid.  You could also use parametrics to vary the design of the balusters.  You could also create dynamic furniture so that you have a couch with 6' length or 8' length.  Chairs with or without arms, bookshelves with different widths or number of shelves... the list is endless.

What I wouldn't do is try to use parametric parts as a replacement or work-around for the architectural tools themselves: the doors, windows, walls, stairs, railings, slabs, and roofs that are AEC parametric objects compatible with AutoCAD Architecture objects.

Another area could be to use parametric parts to create 2D symbols.  Image in landscape architecture if you had plants with different appearance for different seasons, or for different growth sizes at 1 year, 5 years, and 15 years size.  They could be changed even after they are in model by changing their Selection Info.

We'll put together more, and hopefully better examples for you tomorrow.

-- William

Navigation

[0] Message Index

[#] Next page

Go to full version