How to change the height and width of Sketch Symbols?

How to change the height and width of Sketch Symbols?

hamzabuttX6GV8
Contributor Contributor
1,851 Views
7 Replies
Message 1 of 8

How to change the height and width of Sketch Symbols?

hamzabuttX6GV8
Contributor
Contributor

Hi,

 

I have a few images that I want to display, position and size based on some conditions of 3D model (by using iLogic).

 

To control the position of images on drawing sheet, I have inserted the image in the Sketch Symbols.

By using the attribute helper, I can define the position of images (sketch symbols) and define the scale. But I'd like to know/access the height and width of sketch symbols similar to the way we can define height of views (View.Height).

But the problem is that ".Height" or ".Width" returns the error. I need the height and width to set the relative position the other images on the sheet.

 

Pictures of attribute and sketch symbol attached.

 

Following is the code:

'References this document
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisDoc.Document

'References this drawing sheet
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet

'Readys code for Creation of reference points for dimension placement
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
'
'Readys code for creation of general dimensions
Dim oGeneralDims As GeneralDimensions
oGeneralDims = oSheet.DrawingDimensions.GeneralDimensions

'----------

Dim oSkSymDef As SketchedSymbol
oObjs = oDrawDoc.AttributeManager.FindObjects("A", "A", "1")
oSkSymDef = oObjs.Item(1)

Dim oPt1 As Point2d
oPt1 = oTG.CreatePoint2d(0, 0)
oSkSymDef.Position = oPt1
oSkSymDef.Scale= 0.5

 

 

0 Likes
Accepted solutions (1)
1,852 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

The sketch symbol object according to the API help does not have a height and width property. 

 

The size is dictated by what is in the symbol so you will need to either know the size in advance and calculated the positions from there or the more difficult route to look at a sketch internally and translated its size to the position on the drawing sheet. 

To locate the origin position like you have done will get you a known location on the symbol. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 8

hamzabuttX6GV8
Contributor
Contributor

Yup I saw that.

 

But is there a way around it?

Like I drew 2 lines (vertical and horizontal) adjacent to the image borders in the sketch symbol. When you exit the sketcher. Changing the length of line by dragging it, changes the height/width of the sketch symbol (image).

 

I wanted to control the lengths of those lines using parameters in ilogic but sadly I was unable to list the parameters to apply to dimension of line in the sketch symbol sketch editor.

 

If there's a workaround like that then that would be so helpful.

 

Thanks.

0 Likes
Message 4 of 8

WCrihfield
Mentor
Mentor
Accepted solution

Hi @hamzabuttX6GV8.  Just a workaround idea/suggestion...  What about creating two more attributes on that SketchedSymbol or better yet the SketchedSymbolDefinition (one for Height, and one for Width), then setting those to the original sketch size values.  Then when you want to know actual Height & Width of the placed SkecthedSymbol on the sheet, just multiply those by its Scale factor.  Then use Scale to resize it as needed, in relation to its original size, to get the desired size.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 8

hamzabuttX6GV8
Contributor
Contributor

Hi @WCrihfield,

 

Thank you so much. It's working great.

 

There's one issue though. If edit the sketch symbol and save the sketch while exiting, the attribute given to the Sketch Line (For Height or Width) gets deleted and it shows as "nothing" in attribute manager. Is there any way around that?

 

Thanks again for the workaround suggestion.

0 Likes
Message 6 of 8

WCrihfield
Mentor
Mentor

Maybe instead of putting the attribute on the sketch line within the sketched symbol definition sketch, try putting all 3 attributes directly on the SketchedSymbolDefinition object, using its AttributeSets object (or the Nifty Attributes AddIn).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 8

hamzabuttX6GV8
Contributor
Contributor

Sorry, I don't understand what you mean by putting 3 attributes on SketchedSymbolDefinition object.

Do you mean that after exiting the sketch, I assign attributes to both lines and images? When I do that (in Nifty Attributes), the attribute is shown as SketchedSymbol and not as SketchLine. 

0 Likes
Message 8 of 8

WCrihfield
Mentor
Mentor

In my mind I was thinking that once you have edited the sketch of a sketched symbol's definition, you will know its new overall size in height & width.  Then once done editing it and saving it, and are back to regular drawing mode, you could select that sketched symbol definition (below/under the main Drawing Resources folder, then the Sketch Symbols folder), then I assumed you could use the Nifty Attributes to add or edit its attributes which I assumed were something like AttributeSet name "Size" and Attrubute name "Height" and Attribute name "Width", both with numerical values.  Then, since these attributes are on the 'definition' of the sketched symbol, instead of on one placed instance (placed instances are SketchedSymbol, and found under 'Sketched Symbols' folder of individual Sheet), then the original size data could be found from any SketchedSymbol instance you may have placed on the sheet(s), though its definition.  I was mistaken about the third attribute.  The third attribute would be the name identifying one placed instance SketchedSymbol from another, so that would be on each placed instance SketchedSymol, instead of on the main SketchedSymbolDefinition object.  It's a bit difficult to explain, so I hope that makes some amount of sense to you.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes