Difference between revisions of "Cells"
(Created page with 'Placing a cells is similar to placing [[lines] in that both are elements. First you store the cell into a variable then you put that variable into the drawing. <PRE> Dim oCell a…') |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Placing a cells is similar to placing [[lines] in that both are elements. First you store the cell into a variable then you put that variable into the drawing. | + | Placing a cells is similar to placing [[lines]] in that both are elements. First you store the cell into a variable then you put that variable into the drawing. |
<PRE> | <PRE> | ||
Line 5: | Line 5: | ||
</PRE> | </PRE> | ||
− | It makes sense that you would need a point defined just like when your draw a line. But you also have to have a special kind of point called a scaling point and because you can bring a cell in at an angle, you also need a | + | It makes sense that you would need a point defined just like when your draw a line. But you also have to have a special kind of point called a scaling point and because you can bring a cell in at an angle, you also need a [[Rotation Matrix]]. If you want to keep it simple and bring the cell in at a scale of one with no rotation you can set up a point variable and a matrix and then set them to some standard values like this: |
<PRE> | <PRE> | ||
Line 14: | Line 14: | ||
oMatrix = Matrix3dIdentity | oMatrix = Matrix3dIdentity | ||
</PRE> | </PRE> | ||
+ | |||
+ | Now you are ready to place a cell. Assuming the correct cell library is attached (should probably check first), you should be able to store a cell (in this example a cell named "AR34") in the oCell cell element you dimensioned earlier, and then add it to the drawing: | ||
+ | |||
+ | <PRE> | ||
+ | Set oCell = CreateCellElement2("AR34", ptStart, ptScale, False, oMatrix) | ||
+ | ActiveModelReference.AddElement oCell | ||
+ | </PRE> | ||
+ | |||
+ | To rotate the cell when it is placed, use a [[Rotation Matrix]] |
Latest revision as of 14:03, 5 August 2010
Placing a cells is similar to placing lines in that both are elements. First you store the cell into a variable then you put that variable into the drawing.
Dim oCell as CellElement
It makes sense that you would need a point defined just like when your draw a line. But you also have to have a special kind of point called a scaling point and because you can bring a cell in at an angle, you also need a Rotation Matrix. If you want to keep it simple and bring the cell in at a scale of one with no rotation you can set up a point variable and a matrix and then set them to some standard values like this:
Dim ptScale As Point3d Dim oMatrix As Matrix3d ptScale = ActiveSettings.Scale oMatrix = Matrix3dIdentity
Now you are ready to place a cell. Assuming the correct cell library is attached (should probably check first), you should be able to store a cell (in this example a cell named "AR34") in the oCell cell element you dimensioned earlier, and then add it to the drawing:
Set oCell = CreateCellElement2("AR34", ptStart, ptScale, False, oMatrix) ActiveModelReference.AddElement oCell
To rotate the cell when it is placed, use a Rotation Matrix