Insert Sketch Symbol to Snapped Dimension Point

Insert Sketch Symbol to Snapped Dimension Point

ngdnam88
Advocate Advocate
1,047 Views
9 Replies
Message 1 of 10

Insert Sketch Symbol to Snapped Dimension Point

ngdnam88
Advocate
Advocate

Dears,

I'm working in drawing that have insert some sketch symbol to dimension annotation. Is possible insert sketch symbol to green points?

ngnam1988_1-1690424570891.png

Please help me how to do it with iLogic/VB.NET,

Thank very much!

0 Likes
Accepted solutions (3)
1,048 Views
9 Replies
Replies (9)
Message 2 of 10

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi @ngdnam88,

 

Yes indeed, you can. Here is a small code as an exemple (make sure to change the sketched symbol name according to your sketched symbol name) :

Dim d As Inventor.DrawingDimension = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "")
Dim p As Inventor.Point2d = d.DimensionLine.MidPoint

Dim doc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Inventor.Sheet = doc.ActiveSheet

Dim def As Inventor.SketchedSymbolDefinition = doc.SketchedSymbolDefinitions.Item("YourSketchedSymbolName")
Dim sk As Inventor.SketchedSymbol = s.SketchedSymbols.Add(def, p)

Does this suits your need?

 

Kind regards,

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 3 of 10

FINET_Laurent
Advisor
Advisor

@ngdnam88,

 

You can of course get the other points like so :

Dim p As Inventor.Point2d = d.DimensionLine.MidPoint
Dim p As Inventor.Point2d = d.DimensionLine.EndPoint
Dim p As Inventor.Point2d = d.DimensionLine.StartPoint

 

 And so on : 

Dim p As Inventor.Point2d = d.ExtensionLineOne.MidPoint
Dim p As Inventor.Point2d = d.ExtensionLineOne.EndPoint
Dim p As Inventor.Point2d = d.ExtensionLineOne.StartPoint
Dim p As Inventor.Point2d = d.ExtensionLineTwo.MidPoint
Dim p As Inventor.Point2d = d.ExtensionLineTwo.EndPoint
Dim p As Inventor.Point2d = d.ExtensionLineTwo.StartPoint

 

Just pick the one you need. 😃


Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 4 of 10

ngdnam88
Advocate
Advocate

Thank you very much @FINET_Laurent 
I got it!

Message 5 of 10

ngdnam88
Advocate
Advocate

Dear @FINET_Laurent 
I got problem that when move view/dimension the symbol didn't move!

ngnam1988_0-1690522046478.png

 


How to keep symbol constrain with dimension line?
Thanks for your help!

Message 6 of 10

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi @ngdnam88,

 

Here is an article about this specific subject : How to attach sketch symbol to dimension in Inventor drawing (autodesk.com)

 

From this, I made this small code (from the previous code) to add a leader and make it invisible :

Dim d As Inventor.DrawingDimension = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "")
Dim p As Inventor.Point2d = d.DimensionLine.MidPoint

Dim doc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim s As Inventor.Sheet = doc.ActiveSheet

Dim def As Inventor.SketchedSymbolDefinition = doc.SketchedSymbolDefinitions.Item("Boiler axis (note)")
Dim sk As Inventor.SketchedSymbol = s.SketchedSymbols.Add(def, p)

Dim g As GeometryIntent = s.CreateGeometryIntent(d, p)

Dim pc As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
pc.Add(p)
pc.Add(g)

sk.Leader.AddLeader(pc)
sk.LeaderVisible = False

 

Does this suits your needs ? You can mark multiple replies as solution to a topic.


Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 7 of 10

ngdnam88
Advocate
Advocate

Supper @FINET_Laurent 
Is there any difference between normal dim and chain set dim?
I tried your code with chain set dimension, the symbol snap to the end of dim and can moveable with dim value

ngnam1988_0-1690530106162.png

ngnam1988_1-1690530163889.png

 How to snap to green point in chain set dimension?
Thanks,

0 Likes
Message 8 of 10

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi @ngdnam88,

 

Are we talking about this ?

FINET_Laurent_0-1690535577506.png

FINET_Laurent_1-1690535655575.png

 

If yes, selecting a chain dimension like this gives you a collection of dimensions. You can loop trough each of these dimensions and do the same as before. Here is an exemple :

Dim d As LinearGeneralDimension  = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "") 'gives you a collection of dims

For Each dd As Inventor.DrawingDimension In d.ChainDimensionSet.Members 'loop trough this collection
	Dim p As Inventor.Point2d = dd.DimensionLine.MidPoint

	Dim doc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
	Dim s As Inventor.Sheet = doc.ActiveSheet

	Dim def As Inventor.SketchedSymbolDefinition = doc.SketchedSymbolDefinitions.Item("Boiler axis (note)")
	Dim sk As Inventor.SketchedSymbol = s.SketchedSymbols.Add(def, p)

	Dim g As GeometryIntent = s.CreateGeometryIntent(dd, p)

	Dim pc As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	pc.Add(p)
	pc.Add(g)

	sk.Leader.AddLeader(pc)
	sk.LeaderVisible = False
	
Next

Does this suits your needs ? 

Kind regards,

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 9 of 10

ngdnam88
Advocate
Advocate

Thanks for your fast support @FINET_Laurent 
Another case, I only wanna put sketch symbol to one of chain set dimensions not at all. Is it possible?

0 Likes
Message 10 of 10

FINET_Laurent
Advisor
Advisor

Hi @ngdnam88,

 

I'm not aware of a way to do this. The only thing I can see is to have the folowing workflow coded :

1. Select a chainset dimension, by clicking near the desired dimension.

2. Get the point2d of where you clicked with the mouse one 1.

3. Loop through the chainset dimensions one by one and compare with the point2d created on 2.

4. Get the closes dimension

5. Add the sketch symbol to this dimension.

 

To me this looks complicated, but it can be done. 

An easy fix to this issue is to use the other chainset dimensions tool that produces separate dimensions :

FINET_Laurent_0-1691406864293.png

Thus, avoiding the issue of getting a collection of dimensions. 

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes